<html>
<head><meta charset="utf-8"><title>liveness polonius#104 · t-compiler/wg-polonius · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/index.html">t-compiler/wg-polonius</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html">liveness polonius#104</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="163762456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/163762456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#163762456">(Apr 19 2019 at 20:25)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> I see in my to do list that I was supposed to provide some more notes about the next steps for <a href="https://github.com/rust-lang-nursery/polonius/issues/104" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/104">polonius#104</a> -- I'm not 100% sure where you are</p>



<a name="163762463"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/163762463" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#163762463">(Apr 19 2019 at 20:25)</a>:</h4>
<p>If you happen to be around, I have a few questions for you, otherwise I'll take a best guess</p>



<a name="163764374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/163764374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#163764374">(Apr 19 2019 at 20:54)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> ok you can <a href="https://github.com/rust-lang/polonius/issues/104#issuecomment-485011791" target="_blank" title="https://github.com/rust-lang/polonius/issues/104#issuecomment-485011791">see the notes here</a> -- please leave any questions and I'll try to answer, or we can discuss on Tuesday</p>



<a name="163789192"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/163789192" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#163789192">(Apr 20 2019 at 06:16)</a>:</h4>
<p>I was just going to bed when this happened but I will have a look later! Thanks! And at a first glance this was roughly what I needed to get un-stuck, thank you!</p>



<a name="163983809"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/163983809" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#163983809">(Apr 23 2019 at 12:23)</a>:</h4>
<p>For what it's worth, these are my notes from when I tried to figure this out myself. I wasn't <em>that</em> far off!:</p>
<p>## How Calculation Works<br>
1. <code>all_facts</code>is initialised in <code>nll/mod.rs</code>, in <code>compute_regions()</code><br>
2. the variable <code>constraints</code>of type <code>MirTypeckRegionConstraints</code>is extracted from <code>type_check::type_check()</code>’s return value<br>
3. its field <code>liveness_constraints</code>contains <code>LivenessValues</code>, and seems to be filled with live locals in <code>liveness::generate()</code>, which delegates the computation to <code>trace::trace()</code>, as filtered through <code>regions_that_outlive_free_regions()</code> and then <code>compute_live_locals()</code> (used to filter the set of variables to actually bother tracing)<br>
## Notes<br>
- The extraction from MIR happens in the <code>LocalUseMap</code>, which we can probably just steal and use.</p>
<p>## Questions<br>
- should we still compute live locals, or should that pre-filtering too happen in Polonius? It looks very linear to me so maybe that’s fine?<br>
- what happens with variable (“point”) IDs in translation?  The important thing I guess is that it is the same as the ones used in the CFG?<br>
- If we need to run both NLL and Polonius separately, how do we architect the liveness computation-ectomy, given that NLL needs it?<br>
- What should we actually use for the Variable ID in rustc? How do we deal with the fact that variables seems to be unique to regions? Do we need to generate new IDs? Can we just use Locals?</p>



<a name="164090543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164090543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164090543">(Apr 24 2019 at 15:23)</a>:</h4>
<p>Ok, so I have a question now: I have something that seems to work and produces used/defined facts and serialises them to files in rustc, but I have no idea if they are correct as I don't really understand the output. Is there any obvious way to verify it?</p>
<p>Also, I am using the <code>start_index</code> of the <code>Location</code>s for the variables, is that reasonable? I'm not sure about the difference.</p>



<a name="164090622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164090622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164090622">(Apr 24 2019 at 15:24)</a>:</h4>
<p>(Ping @lqd and <span class="user-mention" data-user-id="116009">@nikomatsakis</span> )</p>



<a name="164090641"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164090641" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164090641">(Apr 24 2019 at 15:24)</a>:</h4>
<p>(none of this is pushed anywhere)</p>



<a name="164096025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164096025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164096025">(Apr 24 2019 at 16:26)</a>:</h4>
<p>I was thinking you might be able to compare your rustc output to your test inputs ?</p>



<a name="164096145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164096145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164096145">(Apr 24 2019 at 16:26)</a>:</h4>
<p>(but maybe they’re only in the program facts form so this wouldn’t help)</p>



<a name="164096494"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164096494" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164096494">(Apr 24 2019 at 16:30)</a>:</h4>
<p>I was also thinking this data could be related to the other facts, eg region_live_at, and comparing that relationship à la metamorphic testing</p>



<a name="164096649"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164096649" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164096649">(Apr 24 2019 at 16:32)</a>:</h4>
<p>other than eyeballing and trying to compare to the existing NLL liveness (but I’m not sure they’re identical yet) :(</p>



<a name="164096692"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164096692" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164096692">(Apr 24 2019 at 16:33)</a>:</h4>
<p>maybe <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> has ideas in addition to niko</p>



<a name="164108010"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164108010" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164108010">(Apr 24 2019 at 18:42)</a>:</h4>
<blockquote>
<p>Is there any obvious way to verify it?</p>
</blockquote>
<p>Well, <em>sort of</em> maybe -- polonius had some kind of graphviz mode that we used for visualization, which might let you at least inspect it more naturally. But I don't remember the details and I kind of doubt it will help. Of course, when we get things far enough along, we'll be able to compare the behavior with the existing solver.</p>
<blockquote>
<p>Also, I am using the <code>start_index</code> of the <code>Location</code>s for the variables, is that reasonable? I'm not sure about the difference.</p>
</blockquote>
<p>So, the <em>start point</em> is where we enter the statement, and the <em>mid point</em> is kind of where the statement "takes effect". (To be honest, it would be good to revisit why we have these two points, and some other specifics of polonius -- I had hoped we'd be doing more regular video chats for that purpose.)</p>



<a name="164108059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164108059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164108059">(Apr 24 2019 at 18:43)</a>:</h4>
<p>Anyway, to answer your question -- I think that we should be using the <em>mid</em> point</p>



<a name="164170315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164170315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164170315">(Apr 25 2019 at 13:37)</a>:</h4>
<blockquote>
<p>Anyway, to answer your question -- I think that we should be using the <em>mid</em> point</p>
</blockquote>
<p>I had a vague memory of this which is why I thought to ask; I'll change it to use the mid-points</p>



<a name="164176490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164176490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164176490">(Apr 25 2019 at 14:44)</a>:</h4>
<p>Ok, eyeballing the output and comparing it to the Mir for one of the test inputs, I think it's correct. Should I add the updated inputs with the var_used and var_defined facts to the liveness PR (<a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a>)?</p>



<a name="164176582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164176582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164176582">(Apr 25 2019 at 14:45)</a>:</h4>
<p>I have also opened rust#60266 and marked it as WIP</p>



<a name="164177582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164177582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164177582">(Apr 25 2019 at 14:56)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">rust#60266</a></p>



<a name="164177610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164177610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164177610">(Apr 25 2019 at 14:56)</a>:</h4>
<p>(I added a new linkifier for that format)</p>



<a name="164300941"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164300941" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164300941">(Apr 26 2019 at 21:53)</a>:</h4>
<p>So <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> this looks basically right -- I guess we need to start laying out next steps, eh?</p>



<a name="164322406"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164322406" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164322406">(Apr 27 2019 at 07:09)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> yep!</p>



<a name="164566832"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164566832" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164566832">(Apr 30 2019 at 19:12)</a>:</h4>
<p>OK, I added some notes onto <a href="https://github.com/rust-lang-nursery/polonius/issues/104" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/104">polonius#104</a></p>



<a name="164566845"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164566845" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164566845">(Apr 30 2019 at 19:12)</a>:</h4>
<p>they're kind of high-level, <span class="user-mention" data-user-id="204115">@Albin Stjerna</span>, so feel free to fire questions</p>



<a name="164566863"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164566863" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164566863">(Apr 30 2019 at 19:12)</a>:</h4>
<p>I think the order I would do things is to:</p>
<ul>
<li>extend with drop-uses first and track those</li>
<li>then try to replace the region-live-at in the way I described</li>
</ul>



<a name="164566875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164566875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164566875">(Apr 30 2019 at 19:13)</a>:</h4>
<p>this way we should be able to test as we go</p>



<a name="164567198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164567198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164567198">(Apr 30 2019 at 19:17)</a>:</h4>
<p>Also, maybe we should try to schedule some time to discuss and plan out again?</p>



<a name="164571535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164571535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164571535">(Apr 30 2019 at 20:01)</a>:</h4>
<blockquote>
<p>Also, maybe we should try to schedule some time to discuss and plan out again?</p>
</blockquote>
<p>Sounds good to me! I'll read through your instructions tomorrow and see where that gets me</p>



<a name="164604756"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164604756" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164604756">(May 01 2019 at 06:49)</a>:</h4>
<p>This is a great time to write the section of my thesis that explains what regions are, because I just realised I'm not 100% clear on that</p>



<a name="164611121"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164611121" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164611121">(May 01 2019 at 09:22)</a>:</h4>
<p>Indeed, a good question. Polonius's take is that a "region" is <em>itself</em> sort of meaningless. It is a unique identifier for a particular reference, essentially. However, when you combine this region with <code>subset</code> relations and other things, we determine the relationship of regions to other regions -- basically, the aliasing relationships between references.</p>



<a name="164771287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164771287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164771287">(May 03 2019 at 06:27)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I have added the logic to do drop-live calculations to polonius and rustc (see <a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a> for the logic and <a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">rust#60266</a> for the fact generation). Was this what you had in mind?</p>



<a name="164800156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164800156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164800156">(May 03 2019 at 14:45)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> looking</p>



<a name="164995781"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995781" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995781">(May 06 2019 at 16:22)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> I <a href="https://github.com/rust-lang/polonius/issues/104#issuecomment-489681898" target="_blank" title="https://github.com/rust-lang/polonius/issues/104#issuecomment-489681898">answered you</a> on GH -- sorry, it's hard for me to monitor GH notifications.</p>



<a name="164995792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995792">(May 06 2019 at 16:22)</a>:</h4>
<p>Hopefully that makes sense to you.</p>



<a name="164995877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995877">(May 06 2019 at 16:23)</a>:</h4>
<p>I think so, but was I correct in my assumption that we do need to track drops for points and then do the same point-to-region translation for drops as we do for uses?</p>



<a name="164995886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995886">(May 06 2019 at 16:23)</a>:</h4>
<p>Or have I gotten these mixed up completely?</p>



<a name="164995972"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995972" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995972">(May 06 2019 at 16:24)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="204115">Albin Stjerna</span> I <a href="https://github.com/rust-lang/polonius/issues/104#issuecomment-489681898" target="_blank" title="https://github.com/rust-lang/polonius/issues/104#issuecomment-489681898">answered you</a> on GH -- sorry, it's hard for me to monitor GH notifications.</p>
</blockquote>
<p>I understand; should I ask questions here or ping you in my questions in GH? What's the best way for you?</p>



<a name="164995979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995979">(May 06 2019 at 16:24)</a>:</h4>
<blockquote>
<p>I have added the logic to do drop-live calculations to polonius and rustc (see <a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a> for the logic and <a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">rust#60266</a> for the fact generation). Was this what you had in mind?</p>
</blockquote>
<p>also, these commits look good</p>



<a name="164995984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995984">(May 06 2019 at 16:24)</a>:</h4>
<blockquote>
<p>I understand; should I ask questions here or ping you in my questions in GH? What's the best way for you?</p>
</blockquote>
<p>I'd prefer Zulip</p>



<a name="164995994"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164995994" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164995994">(May 06 2019 at 16:24)</a>:</h4>
<blockquote>
<blockquote>
<p>I understand; should I ask questions here or ping you in my questions in GH? What's the best way for you?</p>
</blockquote>
<p>I'd prefer Zulip</p>
</blockquote>
<p>Noted!</p>



<a name="164996009"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996009" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996009">(May 06 2019 at 16:25)</a>:</h4>
<blockquote>
<p>I think so, but was I correct in my assumption that we do need to track drops for points and then do the same point-to-region translation for drops as we do for uses?</p>
</blockquote>
<p>Yes -- so <a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a> is figuring out where things are "drop-live"</p>



<a name="164996046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996046">(May 06 2019 at 16:25)</a>:</h4>
<p>Also, I'll try to be better at pinging you :)</p>



<a name="164996049"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996049" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996049">(May 06 2019 at 16:25)</a>:</h4>
<p>and your previous commits figured out where things are "use-live"</p>



<a name="164996067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996067">(May 06 2019 at 16:25)</a>:</h4>
<p>er, to be clear, where <em>variables</em> are drop/use-live</p>



<a name="164996071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996071">(May 06 2019 at 16:25)</a>:</h4>
<p>the next step is to translate that into the points where <em>regions</em> are live</p>



<a name="164996147"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996147" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996147">(May 06 2019 at 16:26)</a>:</h4>
<p>the rules are roughly like this:</p>
<div class="codehilite"><pre><span></span>region_live_at(R, P) :-
    var_live_at(V, P),
    var_uses_region(V, R).

region_live_at(R, P) :-
    var_drop_live_at(V, P),
    var_drops_region(V, R).
</pre></div>



<a name="164996200"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996200" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996200">(May 06 2019 at 16:27)</a>:</h4>
<p>And the var_uses_region is a fact, but where does it come from? Fixpoint iteration on subtype relationships from assignments?</p>



<a name="164996222"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996222" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996222">(May 06 2019 at 16:27)</a>:</h4>
<p>no, it has nothing to do with that</p>



<a name="164996227"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996227" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996227">(May 06 2019 at 16:27)</a>:</h4>
<p>it comes by enumerating the regions in the variable's type</p>



<a name="164996232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996232">(May 06 2019 at 16:27)</a>:</h4>
<p>Aaah, ok</p>



<a name="164996244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996244">(May 06 2019 at 16:27)</a>:</h4>
<p>i.e., if the type of <code>V</code> is <code>Foo&lt;'1&gt;</code>, then we have <code>var_uses_region(V, '1)</code></p>



<a name="164996250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996250">(May 06 2019 at 16:28)</a>:</h4>
<p>the "drops" relation is a bit more complex</p>



<a name="164996302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996302">(May 06 2019 at 16:28)</a>:</h4>
<p>in that it is a subset of the regions in the variable's type</p>



<a name="164996313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996313">(May 06 2019 at 16:28)</a>:</h4>
<p>though we could start by generating the same sets (it'd be an overapproximation)</p>



<a name="164996331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996331">(May 06 2019 at 16:28)</a>:</h4>
<p>that might be worthwhile because I think that the rustc analysis is more precise in some other ways, when it comes to drops</p>



<a name="164996346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996346">(May 06 2019 at 16:28)</a>:</h4>
<p>so we can focus on getting the polonius rules right, and have rustc generate too many tuples</p>



<a name="164996356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996356">(May 06 2019 at 16:29)</a>:</h4>
<p>then come back to this</p>



<a name="164996766"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164996766" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164996766">(May 06 2019 at 16:33)</a>:</h4>
<p>Ah, and it would be an over-approximation because not all those uses will actually end in a drop?</p>



<a name="164997054"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997054" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997054">(May 06 2019 at 16:37)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> what I meant by 'overapprox' is that the <code>var_drops_region</code> would have more tuples that we need</p>



<a name="164997068"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997068" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997068">(May 06 2019 at 16:37)</a>:</h4>
<p>a simple example would be <code>x: &amp;'a u32</code>, which is a no-op when dropped (and NLL knows that)</p>



<a name="164997080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997080">(May 06 2019 at 16:37)</a>:</h4>
<p>Ah, ok you mean like that</p>



<a name="164997081"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997081" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997081">(May 06 2019 at 16:37)</a>:</h4>
<p>Ok, that makes sense</p>



<a name="164997092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997092">(May 06 2019 at 16:37)</a>:</h4>
<p>in fact, we'll actually handle that correctly <em>anyway</em>, for other reasons (MIR would have no drop for this type)</p>



<a name="164997465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997465">(May 06 2019 at 16:41)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> I was trying to get you a few tips of where to edit</p>



<a name="164997492"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997492" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997492">(May 06 2019 at 16:41)</a>:</h4>
<p>Yay</p>



<a name="164997571"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164997571" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164997571">(May 06 2019 at 16:42)</a>:</h4>
<p>If I'm not mistaken, the next step is to generate the <code>var_uses_region</code> and <code>var_drops_region</code> facts in rustc?</p>



<a name="164998424"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164998424" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164998424">(May 06 2019 at 16:53)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> Let me know if <a href="https://github.com/rust-lang/polonius/issues/104#issuecomment-489691804" target="_blank" title="https://github.com/rust-lang/polonius/issues/104#issuecomment-489691804">these instructions</a> make sense to you</p>



<a name="164998731"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164998731" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164998731">(May 06 2019 at 16:57)</a>:</h4>
<p>Let me read through them</p>



<a name="164998745"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164998745" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164998745">(May 06 2019 at 16:57)</a>:</h4>
<p>But yes, I think that's the next step as well</p>



<a name="164999354"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164999354" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164999354">(May 06 2019 at 17:05)</a>:</h4>
<blockquote>
<p>So I think what you want to do in your branch is to extend the "popular var liveness function" so that it iterates over the variables declared in mir (the mir.local_decls field). </p>
</blockquote>
<p>First I thought this would be a bad idea because it would mean that the logic would get intermingled with the old logic for calculating liveness/regions, but I don't think that's a problem given that we are planning to remove those when the Polonius logic works, right?</p>



<a name="164999437"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164999437" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164999437">(May 06 2019 at 17:06)</a>:</h4>
<p>So basically, we'd just drop the <code>region_live_at</code> logic</p>



<a name="164999480"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164999480" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164999480">(May 06 2019 at 17:07)</a>:</h4>
<p>Which is interesting, because I guess we could have the compiler save the old values for <code>region_live_at</code> and compare it to the one gotten from Polonius to ensure it's consistent</p>



<a name="164999961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/164999961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#164999961">(May 06 2019 at 17:13)</a>:</h4>
<p>Yeah, we could do that, and yes, that logic will eventually go away</p>



<a name="165000015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165000015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165000015">(May 06 2019 at 17:14)</a>:</h4>
<p>Keeping the ability to compare is probably a good idea</p>



<a name="165001608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165001608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165001608">(May 06 2019 at 17:32)</a>:</h4>
<p>Great! Then I have an idea of where to start tomorrow</p>



<a name="165003283"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165003283" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165003283">(May 06 2019 at 17:53)</a>:</h4>
<p>I'll try to make note of candidates for refactoring for when the precalculation-ectomy happens as well, maybe I can make the code less hard to follow and/or add some documentation</p>



<a name="165086267"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165086267" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165086267">(May 07 2019 at 16:16)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> how goes?</p>



<a name="165092124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165092124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165092124">(May 07 2019 at 17:26)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I spent the morning writing the background section of my report/thesis that explains regions etc while reading through your instructions in the issue on GitHub and cross-referencing with your blog posts, and I think that was a good way to figure out what was going on, but I only got so far as to implement the facts for var_use region and var_drops_region to Polonius. So far things are going well, and I think I have a clear idea of what to do to generate the facts in Rust, but I never got to that before having a migraine attack, and I've been asleep since</p>



<a name="165092471"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165092471" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165092471">(May 07 2019 at 17:31)</a>:</h4>
<p>I did have some trouble figuring out how to add the facts to the polonius-parser lalrpop grammar though, because I'm not sure how to add facts that aren't connected to a point, but I just put that off until later</p>



<a name="165167062"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165167062" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165167062">(May 08 2019 at 14:22)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  var_drops_region and var_uses_region fact generation pushed. The code is more opaque than I would have liked it as I had to work around ownership of some of the essentially global variables passed around between functions, but it appears to be working™</p>



<a name="165181879"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165181879" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165181879">(May 08 2019 at 17:16)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> can you send me a link to the PR(s)?</p>



<a name="165183853"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165183853" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165183853">(May 08 2019 at 17:40)</a>:</h4>
<p>we should probably put them both in the topic title: I think it's <a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a> and <a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">#60266</a> for the rustc side</p>



<a name="165200565"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165200565" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165200565">(May 08 2019 at 21:00)</a>:</h4>
<blockquote>
<p>we should probably put them both in the topic title: I think it's <a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a> and <a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">#60266</a> for the rustc side</p>
</blockquote>
<p>That sounds like a good idea, but I also think it's just the Datafrog code left before the whole liveness logic is done, more or less?</p>



<a name="165200714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165200714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165200714">(May 08 2019 at 21:02)</a>:</h4>
<p>Also, <span class="user-mention" data-user-id="116009">@nikomatsakis</span>: <span class="user-mention" data-user-id="116113">@lqd</span> was right, it's <a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a> and <a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">rust#60266</a></p>



<a name="165200754"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165200754" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165200754">(May 08 2019 at 21:03)</a>:</h4>
<p>I'll get to that tomorrow!</p>



<a name="165238306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238306">(May 09 2019 at 09:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I just realised that it seems that region live uses <a href="https://github.com/rust-lang/rust/blob/81a6aadf83afb53ed7a5a21a283f1f23f68638dd/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L532" target="_blank" title="https://github.com/rust-lang/rust/blob/81a6aadf83afb53ed7a5a21a283f1f23f68638dd/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L532">seems to be generated for both the start and mid-points</a>. Does that mean I should emit a <code>var_live</code> at both the start and mid-points? Does this matter?</p>



<a name="165238467"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238467" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238467">(May 09 2019 at 09:56)</a>:</h4>
<p>I...think this should just work out as long as the variable liveness calculations are correct?</p>



<a name="165238520"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238520" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238520">(May 09 2019 at 09:57)</a>:</h4>
<p>I think that should just fall out naturally, <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> --</p>



<a name="165238527"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238527" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238527">(May 09 2019 at 09:57)</a>:</h4>
<p>we propagate liveness backwards through the CFG</p>



<a name="165238539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238539">(May 09 2019 at 09:57)</a>:</h4>
<p>Hmh</p>



<a name="165238540"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238540" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238540">(May 09 2019 at 09:57)</a>:</h4>
<p>So if you have a "use" at the mid point, it will be "live" at the entry point</p>



<a name="165238547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238547">(May 09 2019 at 09:57)</a>:</h4>
<p>Why is the region_live_at relation a 3-tuple?</p>



<a name="165238593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238593">(May 09 2019 at 09:58)</a>:</h4>
<p>Err, I meant variable</p>



<a name="165238610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238610">(May 09 2019 at 09:58)</a>:</h4>
<p>What are the 3 things? I forget</p>



<a name="165238612"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238612" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238612">(May 09 2019 at 09:58)</a>:</h4>
<p>it could be a mistake :)</p>



<a name="165238615"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238615" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238615">(May 09 2019 at 09:58)</a>:</h4>
<p>Region, Point, and...the empty tuple</p>



<a name="165238620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238620">(May 09 2019 at 09:58)</a>:</h4>
<p>oh</p>



<a name="165238622"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238622" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238622">(May 09 2019 at 09:58)</a>:</h4>
<p>that's a "technicality"</p>



<a name="165238626"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238626" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238626">(May 09 2019 at 09:58)</a>:</h4>
<p>sometimes datafrog wants things to have <code>(key, value)</code> form</p>



<a name="165238629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238629">(May 09 2019 at 09:58)</a>:</h4>
<p>Aah, ok</p>



<a name="165238633"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238633" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238633">(May 09 2019 at 09:58)</a>:</h4>
<p>but in this case the (region, point) is the key</p>



<a name="165238771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238771">(May 09 2019 at 10:00)</a>:</h4>
<p>I ran into some trouble converting the region_live_at back to the relation copy, which I presume must be done at each iteration to keep up with changes</p>



<a name="165238780"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238780" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238780">(May 09 2019 at 10:00)</a>:</h4>
<p>But then it's just a matter of adapting it</p>



<a name="165238789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238789">(May 09 2019 at 10:00)</a>:</h4>
<p>uh</p>



<a name="165238792"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238792" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238792">(May 09 2019 at 10:01)</a>:</h4>
<p>I'm confused :)</p>



<a name="165238816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238816">(May 09 2019 at 10:01)</a>:</h4>
<p>oh, well, we should be removing the region-live-at relation I thnk</p>



<a name="165238820"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238820" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238820">(May 09 2019 at 10:01)</a>:</h4>
<p>it would just become a variable</p>



<a name="165238830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238830">(May 09 2019 at 10:01)</a>:</h4>
<p>I thought it was technically necessary for some Datafrog shenanigans?</p>



<a name="165238834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238834">(May 09 2019 at 10:01)</a>:</h4>
<p>(maybe rename the existing one)</p>



<a name="165238844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238844">(May 09 2019 at 10:01)</a>:</h4>
<p>hmm, oh, because we're using leapjoin?</p>



<a name="165238850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238850">(May 09 2019 at 10:02)</a>:</h4>
<p>we probably need to stop using leapjoin then</p>



<a name="165238898"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238898" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238898">(May 09 2019 at 10:02)</a>:</h4>
<p>I guess that makes sense</p>



<a name="165238903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238903">(May 09 2019 at 10:02)</a>:</h4>
<p>relations are supposed to be "fixed sets that are not varying"</p>



<a name="165238905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238905">(May 09 2019 at 10:02)</a>:</h4>
<p>I think we should stick to that :)</p>



<a name="165238915"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238915" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238915">(May 09 2019 at 10:02)</a>:</h4>
<p>otoh</p>



<a name="165238918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238918">(May 09 2019 at 10:02)</a>:</h4>
<p>wait :)</p>



<a name="165238921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238921">(May 09 2019 at 10:02)</a>:</h4>
<p>Err yes now that you mention that, it sounds like a bad idea to work around the fundamentals of the system</p>



<a name="165238923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238923">(May 09 2019 at 10:02)</a>:</h4>
<p>we could do the liveness computation as a pre-step</p>



<a name="165238925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238925">(May 09 2019 at 10:02)</a>:</h4>
<p>and create the relation only at the end</p>



<a name="165238930"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238930" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238930">(May 09 2019 at 10:02)</a>:</h4>
<p>i.e., we can have two iterations</p>



<a name="165238946"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238946" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238946">(May 09 2019 at 10:03)</a>:</h4>
<p>I considered that as well, but I'm not sure if it's a good idea</p>



<a name="165238952"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238952" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238952">(May 09 2019 at 10:03)</a>:</h4>
<p>I think it would be</p>



<a name="165238958"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238958" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238958">(May 09 2019 at 10:03)</a>:</h4>
<p>among other things, it's probably better locality</p>



<a name="165238959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238959">(May 09 2019 at 10:03)</a>:</h4>
<p>Hmm yes probably because propagation is always additive</p>



<a name="165238968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238968">(May 09 2019 at 10:03)</a>:</h4>
<p>in general, it makes sense for us to "stratify" when we can I think</p>



<a name="165238975"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165238975" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165238975">(May 09 2019 at 10:03)</a>:</h4>
<p>So there's no such thing as having partially completed solutions eliminate parts of the search space for other variables</p>



<a name="165239030"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239030" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239030">(May 09 2019 at 10:04)</a>:</h4>
<p>not sure if I understand</p>



<a name="165239039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239039">(May 09 2019 at 10:04)</a>:</h4>
<p>oh, I see, you're saying "beacuse it's purely additive, that doesn't happen"</p>



<a name="165239043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239043">(May 09 2019 at 10:04)</a>:</h4>
<p>yeah, all of the relations are monotonic -- ever growing</p>



<a name="165239067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239067">(May 09 2019 at 10:05)</a>:</h4>
<p>I'm still too stuck in discrete optimisation where it's the opposite: variables start out enormous and loose values</p>



<a name="165239097"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239097" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239097">(May 09 2019 at 10:05)</a>:</h4>
<p>But yes, I guess the liveness is completely orthogonal</p>



<a name="165239103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239103">(May 09 2019 at 10:05)</a>:</h4>
<p>I see. Still, even there, if you have two variables X and Y, where X depends on Y but not vice versa, it's <em>probably</em> better to iterate and find the minimal Y first..? Anyway, I don't know much about that.</p>



<a name="165239105"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239105" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239105">(May 09 2019 at 10:05)</a>:</h4>
<p>And having it separate would make it easier to share code between the various implementations</p>



<a name="165239151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239151">(May 09 2019 at 10:06)</a>:</h4>
<p>Yes</p>



<a name="165239156"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239156" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239156">(May 09 2019 at 10:06)</a>:</h4>
<p>I was thinking about that too</p>



<a name="165239159"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239159" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239159">(May 09 2019 at 10:06)</a>:</h4>
<p>this would probably be a separate file that naive + opt etc can all share</p>



<a name="165239167"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239167" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239167">(May 09 2019 at 10:06)</a>:</h4>
<p>Not necessarily, because you could learn things about the relations between X and Y such that you can use a partial assignment of Y to immediately shrink the search space of X</p>



<a name="165239194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239194">(May 09 2019 at 10:07)</a>:</h4>
<p>Which might prevent you from exploring large amounts of non-solutions, or worse solutions if you are optimising</p>



<a name="165239215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165239215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165239215">(May 09 2019 at 10:07)</a>:</h4>
<p>But as this is just fix-point set membership, it shouldn't matter. I'll get right to extracting the liveness logic</p>



<a name="165244151"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165244151" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165244151">(May 09 2019 at 11:36)</a>:</h4>
<p>Ok, I have something that seems to work now, but doesn't pass tests. I'll investigate closer later :)</p>



<a name="165244170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165244170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165244170">(May 09 2019 at 11:37)</a>:</h4>
<p>It also doesn't dump the tuples internal to the liveness calculations when dump is enabled</p>



<a name="165244202"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165244202" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165244202">(May 09 2019 at 11:37)</a>:</h4>
<p>And I'm not using the drop-liveness for anything yet, which makes me think that something's still missing</p>



<a name="165245859"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165245859" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165245859">(May 09 2019 at 12:05)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> you need a rule like</p>
<div class="codehilite"><pre><span></span>region_live_at(R, P) :- drop_live_at(V, P), var_drops_region(V, R)
</pre></div>



<a name="165245914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165245914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165245914">(May 09 2019 at 12:06)</a>:</h4>
<p>could that be what's missing?</p>



<a name="165256248"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165256248" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165256248">(May 09 2019 at 14:16)</a>:</h4>
<p>That shouldn’t make any difference should it? Isn’t the over-estimates drop_live_at identical to var_live_at:</p>
<div class="codehilite"><pre><span></span><span class="k">for</span><span class="w"> </span><span class="p">...</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">add_regions</span><span class="p">(</span><span class="n">local</span><span class="p">,</span><span class="w"> </span><span class="n">local_decl</span><span class="p">.</span><span class="n">ty</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">all_facts</span><span class="p">.</span><span class="n">var_uses_regions</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">add_regions</span><span class="p">(</span><span class="n">local</span><span class="p">,</span><span class="w"> </span><span class="n">local_decl</span><span class="p">.</span><span class="n">ty</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="n">all_facts</span><span class="p">.</span><span class="n">var_drops_regions</span><span class="p">);</span><span class="w"> </span><span class="c1">// FIXME(polonius#104) overapproximation</span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="165256433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165256433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165256433">(May 09 2019 at 14:18)</a>:</h4>
<p>Also I had the impression that the idea was to have a separate region logic for the dropped-live relation?</p>



<a name="165267291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165267291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165267291">(May 09 2019 at 16:19)</a>:</h4>
<blockquote>
<p>And I'm not using the drop-liveness for anything yet, which makes me think that something's still missing</p>
</blockquote>
<p>you said you are not using drop-liveness for anything</p>



<a name="165267302"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165267302" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165267302">(May 09 2019 at 16:19)</a>:</h4>
<p>I was saying where I expected the <code>drop_live_at</code> relation to be used</p>



<a name="165267374"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165267374" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165267374">(May 09 2019 at 16:20)</a>:</h4>
<p>Note though that even though <code>var_drops_region</code> and <code>var_uses_region</code> will indeed be the same, the <code>drop_live_at</code> relation is different -- it is "generated" from each drop, but the <code>use_live_at</code> relation is generated from each <strong>use</strong></p>



<a name="165318455"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165318455" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165318455">(May 10 2019 at 08:25)</a>:</h4>
<blockquote>
<p>Note though that even though <code>var_drops_region</code> and <code>var_uses_region</code> will indeed be the same, the <code>drop_live_at</code> relation is different -- it is "generated" from each drop, but the <code>use_live_at</code> relation is generated from each <strong>use</strong></p>
</blockquote>
<p>Ah, of course. So a region can be made live by either being drop-live or use-live, and the lookup in var_drops_region is just that, a lookup, which is why it's safe to over-estimate it. For some reason I had  it in my mind that we were going to separate drops and uses all the way, so that we calculated a region_live_at and a region_drop_live_at, which is why I was confused.</p>



<a name="165327051"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165327051" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165327051">(May 10 2019 at 11:08)</a>:</h4>
<p>Hm, ok all test inputs except the foo functions of vec-push-ref produces identical output to the one from rustc for <code>region_live_at</code>.  They generate a relatively large set of relations (in the range of hundreds), so diffing them is not easy, but I'll look into it</p>



<a name="165336703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165336703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165336703">(May 10 2019 at 13:39)</a>:</h4>
<p>Ok, the difference seems to be the following:</p>
<div class="codehilite"><pre><span></span>&quot;Start(bb0[11])&quot;: input region_live_at &quot;\&#39;_#14r&quot; != calculated &quot;\&#39;_#15r&quot;, &quot;\&#39;_#14r&quot;
&quot;Mid(bb0[11])&quot;: input region_live_at &quot;\&#39;_#14r&quot; != calculated &quot;\&#39;_#15r&quot;, &quot;\&#39;_#14r&quot;
&quot;Start(bb4[0])&quot;: input region_live_at &quot;\&#39;_#13r&quot; != calculated &quot;\&#39;_#14r&quot;, &quot;\&#39;_#13r&quot;
&quot;Mid(bb4[0])&quot;: input region_live_at &quot;\&#39;_#13r&quot; != calculated &quot;\&#39;_#14r&quot;, &quot;\&#39;_#13r&quot;
&quot;Start(bb13[3])&quot;: input region_live_at &quot;\&#39;_#21r&quot; != calculated &quot;\&#39;_#13r&quot;, &quot;\&#39;_#21r&quot;
&quot;Mid(bb13[3])&quot;: input region_live_at &quot;\&#39;_#21r&quot; != calculated &quot;\&#39;_#13r&quot;, &quot;\&#39;_#21r&quot;
</pre></div>


<p>I'm trying to look into what is happening now</p>
<p>signed, <code>albin --verbose</code></p>



<a name="165336730"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165336730" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165336730">(May 10 2019 at 13:39)</a>:</h4>
<p>Also, I'm experimenting with adding a flag to do comparisons for region_live_at to the polonius binary</p>



<a name="165338838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165338838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165338838">(May 10 2019 at 14:09)</a>:</h4>
<div class="codehilite"><pre><span></span> RUST_LOG=info ./target/debug/polonius -a Naive -v -c inputs/vec-push-ref/nll-facts/foo1
 INFO 2019-05-10T14:09:11Z: polonius::cli: region facts compare mode enabled: ignoring provided region_live_at
 INFO 2019-05-10T14:09:11Z: polonius_engine::output::liveness: compute_liveness() completed: 130 tuples, 3.22311ms
 INFO 2019-05-10T14:09:11Z: polonius_engine::output::naive: errors is complete: 1 tuples, 5.607188ms
--------------------------------------------------
Directory: inputs/vec-push-ref/nll-facts/foo1
Time: 0.010s
MISMATCH at location &quot;Start(bb16[2])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb4[0])&quot;: calculated has +[&quot;\&#39;_#14r&quot;], -[]
MISMATCH at location &quot;Mid(bb14[0])&quot;: calculated has +[&quot;\&#39;_#21r&quot;, &quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb0[11])&quot;: calculated has +[&quot;\&#39;_#15r&quot;], -[]
MISMATCH at location &quot;Mid(bb7[0])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb16[2])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Start(bb16[0])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Start(bb16[3])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb15[0])&quot;: calculated has +[&quot;\&#39;_#13r&quot;, &quot;\&#39;_#21r&quot;], -[]
MISMATCH at location &quot;Start(bb13[3])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Start(bb2[0])&quot;: calculated has +[&quot;\&#39;_#14r&quot;], -[]
MISMATCH at location &quot;Start(bb7[0])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb16[3])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb16[0])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb13[3])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Start(bb16[1])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Start(bb14[0])&quot;: calculated has +[&quot;\&#39;_#21r&quot;, &quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Mid(bb16[1])&quot;: calculated has +[&quot;\&#39;_#13r&quot;], -[]
MISMATCH at location &quot;Start(bb4[0])&quot;: calculated has +[&quot;\&#39;_#14r&quot;], -[]
MISMATCH at location &quot;Start(bb15[0])&quot;: calculated has +[&quot;\&#39;_#13r&quot;, &quot;\&#39;_#21r&quot;], -[]
MISMATCH at location &quot;Mid(bb2[0])&quot;: calculated has +[&quot;\&#39;_#14r&quot;], -[]
MISMATCH at location &quot;Start(bb0[11])&quot;: calculated has +[&quot;\&#39;_#15r&quot;], -[]
</pre></div>



<a name="165338923"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165338923" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165338923">(May 10 2019 at 14:10)</a>:</h4>
<p>Ok, so there's an over-approximation of the liveness of some regions</p>



<a name="165377199"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165377199" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165377199">(May 10 2019 at 22:41)</a>:</h4>
<p>there's also a Compare algorithm for debugging/testing (initially to check for differences between Naive and DatafrogOpt), maybe it can be extended for these comparisons as well (although I believe the goal is to eventually remove the rustc-exported <code>region_live_at</code> facts, so it would maybe only be useful for a short while ?)</p>



<a name="165509115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165509115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165509115">(May 13 2019 at 08:44)</a>:</h4>
<p>@lqd Yes, I think this is all very temporary I guess.</p>



<a name="165509291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165509291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165509291">(May 13 2019 at 08:47)</a>:</h4>
<p>Update: I have updated the graphviz output to account for all the liveness facts and outputs (including both region liveness as input and output), and am going through the discrepancies. So far it has been the case every time that a live region in Polonius output that wasn't in the rustc input was derived from a drop-live variable that was correctly calculated as live from the input, so I think this is just an over-approximation</p>



<a name="165513028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165513028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165513028">(May 13 2019 at 09:46)</a>:</h4>
<p>Yes, I can confirm this is the case for all mismatches in foo1 of push-vec-ref</p>



<a name="165513336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165513336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165513336">(May 13 2019 at 09:51)</a>:</h4>
<p>...and some samples from foo2 indicates the same problem</p>



<a name="165555059"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165555059" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165555059">(May 13 2019 at 18:27)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> seems like trying to get drop-live correct is a good next step</p>



<a name="165555190"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165555190" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165555190">(May 13 2019 at 18:28)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="204115">Albin Stjerna</span> seems like trying to get drop-live correct is a good next step</p>
</blockquote>
<p>Yup! Also, I tried removing the generation of region_live_at in rustc and it seems to cause a panic in the compiler due to an unwrap() in some compiletest cases, but I haven't managed to look into it.</p>



<a name="165555232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165555232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165555232">(May 13 2019 at 18:29)</a>:</h4>
<p>(I <code>--bless</code>:ed the output from before I removed the logic and used that for comparison)</p>



<a name="165555995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165555995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165555995">(May 13 2019 at 18:37)</a>:</h4>
<p>OK, <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> --</p>



<a name="165556041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556041">(May 13 2019 at 18:37)</a>:</h4>
<p>I guess I'll try dumping some notes here?</p>



<a name="165556043"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556043" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556043">(May 13 2019 at 18:37)</a>:</h4>
<p>Or would you rather I leave them in Github</p>



<a name="165556111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556111">(May 13 2019 at 18:38)</a>:</h4>
<p>Whichever is the most convenient for you works for me!</p>



<a name="165556182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556182">(May 13 2019 at 18:39)</a>:</h4>
<p>First off, you understand why the "drop live" set of regions is a smaller set than the "use live"?</p>



<a name="165556263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556263">(May 13 2019 at 18:39)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Only very vaguely; I do realise that it might not always be necessary to actually have the referenced value in order to perform a drop, is that correct?</p>



<a name="165556382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556382">(May 13 2019 at 18:40)</a>:</h4>
<p>Yes. The most obvious example is <code>&amp;T</code> -- dropping a reference is a no-op</p>



<a name="165556396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556396">(May 13 2019 at 18:40)</a>:</h4>
<p>that's kind of the "definition" of borrowing--</p>



<a name="165556414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556414">(May 13 2019 at 18:40)</a>:</h4>
<p>you don't free the memory when your borrowed reference goes out of scope ;)</p>



<a name="165556470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556470">(May 13 2019 at 18:41)</a>:</h4>
<p>Ah, no that would be...bad</p>



<a name="165556476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556476">(May 13 2019 at 18:41)</a>:</h4>
<p>In any case, we have a bunch of existing infrastructure around this, mostly to support cyclic data structures in some cases.</p>



<a name="165556512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556512">(May 13 2019 at 18:41)</a>:</h4>
<p>To some extent that's historical (pre-exists the move to NLL, anyway)</p>



<a name="165556648"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556648" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556648">(May 13 2019 at 18:42)</a>:</h4>
<p>the summary is roughly this:</p>
<ul>
<li>if your type declares <code>Drop</code>, then we assume it might access any of its fields</li>
<li>but if it does <strong>not</strong>, then we know that all it does is to free its fields</li>
<li>and there is an (unstable) way that types can declare that all they do is <em>drop</em> data</li>
</ul>



<a name="165556666"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556666" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556666">(May 13 2019 at 18:42)</a>:</h4>
<p>so e.g. we know that a <code>Vec&lt;&amp;T&gt;</code> does not, in its destructor, use those references</p>



<a name="165556685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556685">(May 13 2019 at 18:42)</a>:</h4>
<p>this permits you to create cycles in some cases</p>



<a name="165556695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556695">(May 13 2019 at 18:43)</a>:</h4>
<p>e.g., you can have an arena that allocates memory</p>



<a name="165556715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556715">(May 13 2019 at 18:43)</a>:</h4>
<p>and you can allocate a vector in that arena</p>



<a name="165556722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556722">(May 13 2019 at 18:43)</a>:</h4>
<p>which contains references to other things allocated from that arena</p>



<a name="165556757"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556757" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556757">(May 13 2019 at 18:43)</a>:</h4>
<p>Ah, and the vector of course doesn't bother managing the actual data it saves references to, makes sense</p>



<a name="165556762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556762">(May 13 2019 at 18:43)</a>:</h4>
<p>this is a "cycle" of sorts because we cannot really tell whether the vector or the things it is referencing will be freed first</p>



<a name="165556770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556770">(May 13 2019 at 18:43)</a>:</h4>
<p>(but we don't care)</p>



<a name="165556805"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556805" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556805">(May 13 2019 at 18:43)</a>:</h4>
<p>(since we know that the vector won't be accessing those things)</p>



<a name="165556855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556855">(May 13 2019 at 18:44)</a>:</h4>
<p>so that's kind of the "background"</p>



<a name="165556877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556877">(May 13 2019 at 18:44)</a>:</h4>
<p>what we basically want to do is to leverage this already existing code</p>



<a name="165556935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165556935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165556935">(May 13 2019 at 18:44)</a>:</h4>
<p>which essentially, given a type <code>T</code>, will figure out what set of other types have to be live when <code>T</code> is dropped</p>



<a name="165557028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557028">(May 13 2019 at 18:45)</a>:</h4>
<p>Hm, this sounds like it might translate to some sort of transitive logic</p>



<a name="165557033"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557033" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557033">(May 13 2019 at 18:45)</a>:</h4>
<p>that is what this <a href="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L538-L554" target="_blank" title="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L538-L554"><code>compute_drop_data</code></a> function is doing</p>



<a name="165557050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557050">(May 13 2019 at 18:45)</a>:</h4>
<p>well, polonius doesn't really have to do this bit</p>



<a name="165557114"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557114" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557114">(May 13 2019 at 18:45)</a>:</h4>
<p>I figured it sounded very much like something that must happen in rustc</p>



<a name="165557174"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557174" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557174">(May 13 2019 at 18:46)</a>:</h4>
<p>Or at least should</p>



<a name="165557193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557193">(May 13 2019 at 18:46)</a>:</h4>
<p>YEah</p>



<a name="165557213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557213">(May 13 2019 at 18:46)</a>:</h4>
<p>I guess the real function that you want to start from is <a href="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L446-L457" target="_blank" title="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L446-L457"><code>add_drop_live_facts_for</code></a></p>



<a name="165557263"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557263" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557263">(May 13 2019 at 18:47)</a>:</h4>
<p>But can this <em>just</em> be done in rustc, i.e. by not emitting drop-use facts in the right places, or is there more to this?</p>



<a name="165557394"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557394" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557394">(May 13 2019 at 18:48)</a>:</h4>
<p>yeah, it can just be done in rustc, the idea is that we will emit the <code>var_drops_region</code> facts</p>



<a name="165557402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557402">(May 13 2019 at 18:48)</a>:</h4>
<p>to account for this</p>



<a name="165557418"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557418" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557418">(May 13 2019 at 18:48)</a>:</h4>
<p>i.e., if you have a variable <code>x</code> with a type like <code>Vec&lt;&amp;'a u32&gt;</code></p>



<a name="165557460"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557460" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557460">(May 13 2019 at 18:48)</a>:</h4>
<p>you would have a <code>var_uses_region(x, 'a)</code> fact</p>



<a name="165557476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557476">(May 13 2019 at 18:48)</a>:</h4>
<p>but you would <strong>not</strong> have a <code>var_drops_region(x, 'a)</code> fact</p>



<a name="165557505"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557505" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557505">(May 13 2019 at 18:49)</a>:</h4>
<p>thus, if <code>x</code> is use-live at some point, the region <code>'a</code> must be live</p>



<a name="165557524"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557524" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557524">(May 13 2019 at 18:49)</a>:</h4>
<p>but if <code>x</code> is only drop-live at some point, region <code>'a</code> may not be live</p>



<a name="165557532"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557532" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557532">(May 13 2019 at 18:49)</a>:</h4>
<p>but it won't drop the <code>u32</code> when it's deallocated</p>



<a name="165557687"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557687" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557687">(May 13 2019 at 18:50)</a>:</h4>
<p>Hm, but isn't that the case for all references? I thought the owning data structure was responsible for the deallocation?</p>



<a name="165557775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557775">(May 13 2019 at 18:51)</a>:</h4>
<p>err, ok but of course not the liveness, ok I get it</p>



<a name="165557778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557778">(May 13 2019 at 18:51)</a>:</h4>
<p>(I think)</p>



<a name="165557795"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557795" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557795">(May 13 2019 at 18:51)</a>:</h4>
<p>it's not really about the <em>u32</em></p>



<a name="165557806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557806">(May 13 2019 at 18:51)</a>:</h4>
<p>it's about the reference <code>&amp;'a u32</code> -- is somebody going to potentially dereference it in the future?</p>



<a name="165557875"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557875" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557875">(May 13 2019 at 18:52)</a>:</h4>
<p>if the vector is "use-live", then we are accessing it in some ordinary way</p>



<a name="165557886"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557886" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557886">(May 13 2019 at 18:52)</a>:</h4>
<p>e.g., invoking a methed like <code>pop</code> or whatever</p>



<a name="165557892"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557892" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557892">(May 13 2019 at 18:52)</a>:</h4>
<p>so we have to assume that whatever references are in it may get used</p>



<a name="165557907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557907">(May 13 2019 at 18:52)</a>:</h4>
<p>but if we know the vector is just going to get dropped, we know they won't (because of this pre-existing drop analysis)</p>



<a name="165557914"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557914" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557914">(May 13 2019 at 18:52)</a>:</h4>
<p>oh, ok, so the point is that the deallocator for the vec might need what the reference is referencing?</p>



<a name="165557933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557933">(May 13 2019 at 18:53)</a>:</h4>
<p>or in this case, that it won't</p>



<a name="165557935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557935">(May 13 2019 at 18:53)</a>:</h4>
<p>right. it doesn't, but other drop code could</p>



<a name="165557973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557973">(May 13 2019 at 18:53)</a>:</h4>
<p>ok, I see, and if something implements <code>Drop</code> then it could do anything and all bets are off</p>



<a name="165557976"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165557976" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165557976">(May 13 2019 at 18:53)</a>:</h4>
<p>e.g., maybe you have </p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">data</span>: <span class="kp">&amp;</span><span class="na">&#39;a</span><span class="w"> </span><span class="kt">u32</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">Drop</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Foo</span><span class="o">&lt;</span><span class="na">&#39;a</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="k">fn</span> <span class="nf">drop</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="cm">/* we assume this could do something like `*self.data;` */</span><span class="w"></span>
<span class="w">  </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="165558001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558001">(May 13 2019 at 18:53)</a>:</h4>
<p>in that case, if you have <code>y: Foo&lt;'a&gt;</code> you would have <code>var_drops_region(y, 'a)</code></p>



<a name="165558080"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558080" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558080">(May 13 2019 at 18:54)</a>:</h4>
<p>(though really we're more conservative than that -- i.e., as you say, we don't examine the body of the drop closely)</p>



<a name="165558201"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558201" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558201">(May 13 2019 at 18:55)</a>:</h4>
<p>(where is your branch again, <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> ?)</p>



<a name="165558265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558265">(May 13 2019 at 18:56)</a>:</h4>
<p>Anyway, the relevant bit of the older code is <a href="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L492-L502" target="_blank" title="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L492-L502">this for loop here</a></p>



<a name="165558278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558278">(May 13 2019 at 18:56)</a>:</h4>
<div class="codehilite"><pre><span></span><span class="w"> </span><span class="c1">// All things in the `outlives` array may be touched by</span>
<span class="w">        </span><span class="c1">// the destructor and must be live at this point.</span>
<span class="w">        </span><span class="k">for</span><span class="w"> </span><span class="o">&amp;</span><span class="n">kind</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">&amp;</span><span class="n">drop_data</span><span class="p">.</span><span class="n">dropck_result</span><span class="p">.</span><span class="n">kinds</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">Self</span>::<span class="n">make_all_regions_live</span><span class="p">(</span><span class="w"></span>
<span class="w">                </span><span class="bp">self</span><span class="p">.</span><span class="n">elements</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">typeck</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="n">kind</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="n">live_at</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="bp">self</span><span class="p">.</span><span class="n">location_table</span><span class="p">,</span><span class="w"></span>
<span class="w">            </span><span class="p">);</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="165558322"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558322" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558322">(May 13 2019 at 18:56)</a>:</h4>
<p>this "drop data" is cached from <a href="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L538-L541" target="_blank" title="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L538-L541">the function <code>compute_drop_data</code> here</a></p>



<a name="165558323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558323">(May 13 2019 at 18:56)</a>:</h4>
<p>For rustc, <a href="https://github.com/albins/rust/tree/polonius-liveness" target="_blank" title="https://github.com/albins/rust/tree/polonius-liveness">it's here</a></p>



<a name="165558373"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558373" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558373">(May 13 2019 at 18:57)</a>:</h4>
<p>basically the <code>drop_data.dropck_result.kinds</code> is a list of types/regions things that the <code>Drop</code> code "may" access</p>



<a name="165558396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558396">(May 13 2019 at 18:57)</a>:</h4>
<p>so what we do is we iterate over each of those and make sure they are live</p>



<a name="165558408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558408">(May 13 2019 at 18:57)</a>:</h4>
<p>I imagine your code would want to do something similar, but emitted <code>var_drops_region</code> facts for each thing contained within</p>



<a name="165558504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558504">(May 13 2019 at 18:58)</a>:</h4>
<p>ok, but doesn't that mean we will emot more <code>var_drops_region</code>and not fewer?</p>



<a name="165558515"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558515" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558515">(May 13 2019 at 18:58)</a>:</h4>
<p>( now, before that for loop, <a href="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L475-L490" target="_blank" title="https://github.com/rust-lang/rust/blob/a9ec99f4201ec33026a468ef1289f98a95b4d71a/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L475-L490">we do some other stuff</a> -- this actually isn't, I don't think, relevant to what we are trying to do right now. It's a separate consideration. )</p>



<a name="165558516"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558516" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558516">(May 13 2019 at 18:58)</a>:</h4>
<p>Or do you mean we do this in stead of the previous logic?</p>



<a name="165558523"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558523" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558523">(May 13 2019 at 18:58)</a>:</h4>
<blockquote>
<p>Or do you mean we do this in stead of the previous logic?</p>
</blockquote>
<p>that</p>



<a name="165558539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558539">(May 13 2019 at 18:59)</a>:</h4>
<p>Ok!</p>



<a name="165558643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558643">(May 13 2019 at 19:00)</a>:</h4>
<p>I'm not sure how difficult it will be to re-use that existing stuff</p>



<a name="165558738"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558738" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558738">(May 13 2019 at 19:00)</a>:</h4>
<p>So far my strategy of trying something and then fixing the compiler errors has worked out quite well</p>



<a name="165558821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558821">(May 13 2019 at 19:01)</a>:</h4>
<p>from a quick glance I <em>suspect</em> you can just kind of "copy-paste" what you need ..</p>



<a name="165558831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558831">(May 13 2019 at 19:01)</a>:</h4>
<p>ok, so, I <em>think</em> that's it for the var-drop-region business</p>



<a name="165558848"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558848" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558848">(May 13 2019 at 19:01)</a>:</h4>
<p>I thought there was more to it, but I realize now I was misremembering</p>



<a name="165558856"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558856" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558856">(May 13 2019 at 19:01)</a>:</h4>
<p>Well, let's start there tomorrow and see what breaks</p>



<a name="165558917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558917">(May 13 2019 at 19:02)</a>:</h4>
<p>sounds good</p>



<a name="165558953"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558953" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558953">(May 13 2019 at 19:02)</a>:</h4>
<p>I mean, spending a day looking at the graphviz outputs and tracing liveness etc was an excellent exercise</p>



<a name="165558993"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165558993" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165558993">(May 13 2019 at 19:03)</a>:</h4>
<p>By the way, these inputs, are they from NLL's borrowcheck?</p>



<a name="165559065"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165559065" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165559065">(May 13 2019 at 19:04)</a>:</h4>
<p>I'm trying to get a feel for which parts would need to be re-engineered when it's possible to run Polonius without NLL (and also just how things fit together in general), and so far my hunch is "virtually everything"</p>



<a name="165569203"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165569203" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165569203">(May 13 2019 at 21:06)</a>:</h4>
<blockquote>
<p>By the way, these inputs, are they from NLL's borrowcheck?</p>
</blockquote>
<p>the NLL "borrow check" includes a "type check"</p>



<a name="165569210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165569210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165569210">(May 13 2019 at 21:06)</a>:</h4>
<p>the liveness constraint code you are editing is part of that</p>



<a name="165569219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165569219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165569219">(May 13 2019 at 21:06)</a>:</h4>
<p>this type check generates the base constraints (the <code>subset</code> relations, in polonius speak)</p>



<a name="165569241"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165569241" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165569241">(May 13 2019 at 21:07)</a>:</h4>
<p>actually most of the NLL code is still needed</p>



<a name="165569258"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165569258" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165569258">(May 13 2019 at 21:07)</a>:</h4>
<p>it's only a relatively small part -- the "region inference" -- that goes away <em>completely</em></p>



<a name="165619806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165619806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165619806">(May 14 2019 at 13:03)</a>:</h4>
<p>Ah, ok I see</p>



<a name="165633897"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165633897" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165633897">(May 14 2019 at 15:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I have modified rustc to output <code>var_drops_region</code> according to your instructions; it compiles and the resulting liveness analysis is the same for all the inputs except clap-rs, which I haven't tested. But none of those actually produce any tuples for <code>var_drops_region</code>, so I have no positive examples</p>



<a name="165633933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165633933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165633933">(May 14 2019 at 15:51)</a>:</h4>
<p>(I'm going away for a while now, but I'll be back for the meeting)</p>



<a name="165637655"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165637655" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165637655">(May 14 2019 at 16:33)</a>:</h4>
<p>...nope, clap-rs doesn't either. Apparently, drop-liveness isn't that common</p>



<a name="165643582"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165643582" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165643582">(May 14 2019 at 17:37)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> I have modified rustc to output <code>var_drops_region</code> according to your instructions; it compiles and the resulting liveness analysis is the same for all the inputs except clap-rs, which I haven't tested. But none of those actually produce any tuples for <code>var_drops_region</code>, so I have no positive examples</p>
</blockquote>
<p>lol</p>



<a name="165643656"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165643656" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165643656">(May 14 2019 at 17:38)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> I can point you at some test cases</p>



<a name="165647064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165647064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165647064">(May 14 2019 at 18:14)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="204115">Albin Stjerna</span> I can point you at some test cases</p>
</blockquote>
<p>That would be great! Thanks :)</p>



<a name="165647799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165647799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165647799">(May 14 2019 at 18:22)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> ok it seems to work for the example you gave above too, which <em>does</em> generate one <code>var_drops_region</code> fact</p>



<a name="165647841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165647841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165647841">(May 14 2019 at 18:23)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> try e.g. <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/drop-may-dangle.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/drop-may-dangle.rs">drop-may-dangle</a></p>



<a name="165647872"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165647872" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165647872">(May 14 2019 at 18:23)</a>:</h4>
<p>and <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/drop-no-may-dangle.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/drop-no-may-dangle.rs">drop-no-may-dangle</a></p>



<a name="165647911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165647911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165647911">(May 14 2019 at 18:23)</a>:</h4>
<p>basically any test in src/test/ui/nll/ with drop in the name :)</p>



<a name="165647944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165647944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165647944">(May 14 2019 at 18:24)</a>:</h4>
<p>e.g. <a href="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/enum-drop-access.rs" target="_blank" title="https://github.com/rust-lang/rust/blob/master/src/test/ui/nll/enum-drop-access.rs">enum-drop-access</a></p>



<a name="165728908"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165728908" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165728908">(May 15 2019 at 16:20)</a>:</h4>
<p>I have added a set of tests that compares the region_live_at output to the input from rustc, and it seems that there is a slight discrepancy in some tests. I'll look into it later, but it seems that a region is live in Polonius input when it isn't in Rustc</p>



<a name="165789465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165789465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165789465">(May 16 2019 at 08:20)</a>:</h4>
<p>OK, I have looked into it, and it looks sort of reasonable to me. What seems to happen is that variable <code>_2</code> is drop-used at <code>Mid(bb16[1])</code>, which makes it drop-live, and more importantly its region <code>_#r13</code>. However, that region isn't reported as live by rustc. It's all running this code:</p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">Wrap</span><span class="o">&lt;</span><span class="na">&#39;p</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">p</span>: <span class="kp">&amp;</span><span class="na">&#39;p</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="kt">i32</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="na">&#39;p</span><span class="o">&gt;</span><span class="w"> </span><span class="nb">Drop</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Wrap</span><span class="o">&lt;</span><span class="na">&#39;p</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">drop</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="o">*</span><span class="bp">self</span><span class="p">.</span><span class="n">p</span><span class="w"> </span><span class="o">+=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Foo</span><span class="o">&lt;</span><span class="na">&#39;p</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">a</span>: <span class="nb">String</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">Wrap</span><span class="o">&lt;</span><span class="na">&#39;p</span><span class="o">&gt;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">wrap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Wrap</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">p</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">String</span>::<span class="n">from</span><span class="p">(</span><span class="s">&quot;str&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">a</span>: <span class="nc">s</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">wrap</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">drop</span><span class="p">(</span><span class="n">foo</span><span class="p">.</span><span class="n">a</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">drop</span><span class="p">(</span><span class="n">foo</span><span class="p">.</span><span class="n">b</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"> </span><span class="c1">//~ ERROR cannot assign to `x` because it is borrowed [E0506]</span>
<span class="w">    </span><span class="c1">// FIXME ^ This currently errors and it should not.</span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>The MIR of <code>bb16</code>and <code>bb17</code> looks like this:</p>
<div class="codehilite"><pre><span></span><span class="n">bb16</span>: <span class="p">{</span><span class="w"></span>
<span class="w">     </span><span class="n">StorageDead</span><span class="p">(</span><span class="n">_5</span><span class="p">);</span><span class="w">                 </span><span class="c1">// bb16[0]: scope 4 at maybe-initialized-drop-with-uninitialized-fragments.rs:24:1: 24:2</span>
<span class="w">     </span><span class="n">drop</span><span class="p">(</span><span class="n">_2</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="k">return</span>: <span class="nc">bb17</span><span class="p">,</span><span class="w"> </span><span class="n">unwind</span>: <span class="nc">bb1</span><span class="p">];</span><span class="w"> </span><span class="c1">// bb16[1]: scope 2 at maybe-initialized-drop-with-uninitialized-fragments.rs:24:1: 24:2</span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>

<span class="w"> </span><span class="n">bb17</span>: <span class="p">{</span><span class="w"></span>
<span class="w">     </span><span class="n">StorageDead</span><span class="p">(</span><span class="n">_2</span><span class="p">);</span><span class="w">                 </span><span class="c1">// bb17[0]: scope 2 at maybe-initialized-drop-with-uninitialized-fragments.rs:24:1: 24:2</span>
<span class="w">     </span><span class="n">StorageDead</span><span class="p">(</span><span class="n">_1</span><span class="p">);</span><span class="w">                 </span><span class="c1">// bb17[1]: scope 0 at maybe-initialized-drop-with-uninitialized-fragments.rs:24:1: 24:2</span>
<span class="w">     </span><span class="k">return</span><span class="p">;</span><span class="w">                          </span><span class="c1">// bb17[2]: scope 0 at maybe-initialized-drop-with-uninitialized-fragments.rs:24:2: 24:2</span>
<span class="w"> </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p><a href="/user_uploads/4715/EZOl3oKh4JM5T2hftz456CxH/bug.pdf" target="_blank" title="bug.pdf">PDF of the graph with all facts and outputs from Polonius</a></p>



<a name="165789585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165789585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165789585">(May 16 2019 at 08:23)</a>:</h4>
<p>Is there any further optimisation in rustc that I'm not thinking of, or is this a bug?</p>



<a name="165833667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165833667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165833667">(May 16 2019 at 18:05)</a>:</h4>
<p>Ah, <span class="user-mention" data-user-id="204115">@Albin Stjerna</span>, <em>right</em> -- I knew there was a wrinkle</p>



<a name="165833672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165833672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165833672">(May 16 2019 at 18:06)</a>:</h4>
<p>I somehow overlooked it though</p>



<a name="165833726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165833726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165833726">(May 16 2019 at 18:06)</a>:</h4>
<p>So rustc is correct, but our analysis is a bit too simplistic as we've done it so far</p>



<a name="165833742"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165833742" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165833742">(May 16 2019 at 18:06)</a>:</h4>
<p>This actually touches on the next step -- computing moves and initialization</p>



<a name="165833779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165833779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165833779">(May 16 2019 at 18:06)</a>:</h4>
<p>I have to look at how this works in rustc, but the idea is that we know that <code>foo.b</code> has been <em>moved</em></p>



<a name="165833798"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165833798" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165833798">(May 16 2019 at 18:07)</a>:</h4>
<p>To be clear though, rustc is <em>not</em> giving an error here? But polonius is?</p>



<a name="165833806"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165833806" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165833806">(May 16 2019 at 18:07)</a>:</h4>
<p>Because the FIXME etc above suggests rustc does</p>



<a name="165844127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165844127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165844127">(May 16 2019 at 20:01)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> </p>
<blockquote>
<p>To be clear though, rustc is <em>not</em> giving an error here? But polonius is?</p>
</blockquote>
<p>No they both give errors, but the difference is that Polonius gives a different <code>region_live_at</code> than rustc, with a region being live in more places than in the rustc output</p>



<a name="165844353"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165844353" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165844353">(May 16 2019 at 20:04)</a>:</h4>
<p>This happens for all the similar examples, so I think it's the same problem</p>



<a name="165855610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855610">(May 16 2019 at 22:43)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> So, I think the crucial part of the code in rustc is <a href="https://github.com/rust-lang/rust/blob/7d5aa43325ad7629766b1183011f5bf5b2a1ea26/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L225" target="_blank" title="https://github.com/rust-lang/rust/blob/7d5aa43325ad7629766b1183011f5bf5b2a1ea26/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L225">this line here</a>:</p>
<div class="codehilite"><pre><span></span><span class="w"> </span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">initialized_at_terminator</span><span class="p">(</span><span class="n">location</span><span class="p">.</span><span class="n">block</span><span class="p">,</span><span class="w"> </span><span class="n">mpi</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="p">...</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="165855625"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855625" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855625">(May 16 2019 at 22:43)</a>:</h4>
<p>the idea is that we only consider a <code>Drop(x)</code> instruction in the MIR to be "live" if <code>x</code> is <em>initialized</em> (i.e., has a value that has not been moved out in the interim)</p>



<a name="165855688"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855688" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855688">(May 16 2019 at 22:44)</a>:</h4>
<p>this is because, in Rust, we have stuff like this:</p>
<div class="codehilite"><pre><span></span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[];</span><span class="w"></span>
<span class="w">    </span><span class="n">send</span><span class="p">(</span><span class="n">x</span><span class="p">);</span><span class="w"> </span><span class="c1">// moves `x` away</span>
<span class="p">}</span><span class="w"> </span><span class="c1">// `x` is not dropped here</span>
</pre></div>



<a name="165855701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855701">(May 16 2019 at 22:44)</a>:</h4>
<p>in the MIR, we generate a <code>Drop(x)</code> either way to start, but then we later (in a phase called "drop elaboration") remove it</p>



<a name="165855715"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855715" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855715">(May 16 2019 at 22:44)</a>:</h4>
<p>at the time when borrowck runs, the drop is still there, but it is considered to only be "active" if <code>x</code> is (maybe) initialized</p>



<a name="165855740"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855740" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855740">(May 16 2019 at 22:45)</a>:</h4>
<p>note that in some cases this is not known until runtime, e.g.</p>
<div class="codehilite"><pre><span></span><span class="p">{</span><span class="w"></span>
<span class="w">  </span><span class="kd">let</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">vec</span><span class="o">!</span><span class="p">[];</span><span class="w"></span>
<span class="w">  </span><span class="k">if</span><span class="w"> </span><span class="n">something</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">send</span><span class="p">(</span><span class="n">x</span><span class="p">);</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"> </span><span class="c1">// might or might not drop `x`, depending whether `something` was true</span>
</pre></div>



<a name="165855753"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855753" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855753">(May 16 2019 at 22:45)</a>:</h4>
<p>Anyway, as a temporary fix, we could add a similar call to the fact generation, basically only generating a <code>DropUse(X, P)</code> fact if <code>X</code> is initialized at <code>P</code> (using that same function to test)</p>



<a name="165855758"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165855758" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165855758">(May 16 2019 at 22:45)</a>:</h4>
<p>But longer term I want polonius to be computing the initialization facts as well</p>



<a name="165877396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165877396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165877396">(May 17 2019 at 06:51)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Hm, I'll have to chew on that one for a while, because it's not entirely trivial to add that logic to the current drop-live generation logic. Maybe it would be simpler to just piggy-back off of <code>trace()</code> in stead of trying to walk the MIR with a Visitor?</p>



<a name="165902701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/165902701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#165902701">(May 17 2019 at 14:03)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> quite likely yes. it would presumably only be temporary until we move that other logic into polonius (whihc I imagine we'll do next)</p>



<a name="166095369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166095369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166095369">(May 20 2019 at 15:42)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> </p>
<blockquote>
<p><span class="user-mention silent" data-user-id="204115">Albin Stjerna</span> quite likely yes. it would presumably only be temporary until we move that other logic into polonius (whihc I imagine we'll do next)</p>
</blockquote>
<p>I did as you suggested, but the output is still not the same. It still has region 13 live when it shouldn't be, but several other <code>var_drop_used</code> disappears. It seems that <a href="https://github.com/rust-lang/rust/issues/13" target="_blank" title="https://github.com/rust-lang/rust/issues/13">#13</a> is made live from the presence of <code>"_2" "Mid(bb3[0])"</code> in <code>var_drop_used</code>. However, when I simply remove that from the facts file, I get a mismatch saying that <a href="https://github.com/rust-lang/rust/issues/13" target="_blank" title="https://github.com/rust-lang/rust/issues/13">#13</a> should be live at <code>"Start(bb3[0])</code> and Mid, but isn't. Honestly, I'm not sure what's going on. At bb3, _8, which is where _2 is moved, is already <code>drop()</code>ped? I don't see how rustc should output a fact then.</p>
<p>Just to be sure, I am recompiling rustc, but I'm sending this now in case you see something I don't.</p>



<a name="166149041"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166149041" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166149041">(May 21 2019 at 07:35)</a>:</h4>
<p>I did it like this though, and it seems to produce equivalent but less output:</p>
<div class="codehilite"><pre><span></span><span class="k">if</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">initialized_at_terminator</span><span class="p">(</span><span class="n">location</span><span class="p">.</span><span class="n">block</span><span class="p">,</span><span class="w"> </span><span class="n">mpi</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">facts</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">typeck</span><span class="p">.</span><span class="n">borrowck_context</span><span class="p">.</span><span class="n">as_mut</span><span class="p">().</span><span class="n">unwrap</span><span class="p">().</span><span class="n">all_facts</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="n">facts</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">var_drop_used</span><span class="w"></span>
<span class="w">                        </span><span class="p">.</span><span class="n">push</span><span class="p">((</span><span class="n">local</span><span class="p">,</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">cx</span><span class="p">.</span><span class="n">location_table</span><span class="p">.</span><span class="n">mid_index</span><span class="p">(</span><span class="n">location</span><span class="p">)));</span><span class="w"></span>
<span class="w">                </span><span class="p">}</span><span class="w"></span>
</pre></div>



<a name="166149148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166149148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166149148">(May 21 2019 at 07:37)</a>:</h4>
<p>Gotta love those five levels of wrapping data structures</p>



<a name="166172220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166172220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166172220">(May 21 2019 at 13:32)</a>:</h4>
<p>I have another question while I'm at it: I need to extend polonius-parser's grammar with var_uses_region and var_drops_region, but I'm not sure how to do that in the lalrpop syntax</p>



<a name="166172294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166172294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166172294">(May 21 2019 at 13:33)</a>:</h4>
<p>I guess it should work kind of like universal_regions, in that it's one global declaration?</p>



<a name="166173071"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166173071" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166173071">(May 21 2019 at 13:42)</a>:</h4>
<p>I figure I should do something like this to begin with:</p>
<div class="codehilite"><pre><span></span><span class="n">VarRegionMappings</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Comma</span><span class="o">&lt;</span><span class="n">VarRegionMapping</span><span class="o">&gt;</span><span class="p">;</span><span class="w"></span>
<span class="n">VarRegionMapping</span>: <span class="p">(</span><span class="nb">String</span><span class="p">,</span><span class="w"> </span><span class="nb">String</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                 </span><span class="s">&quot;(&quot;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Variable</span><span class="o">&gt;</span><span class="w"> </span><span class="s">&quot;,&quot;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">Region</span><span class="o">&gt;</span><span class="w"> </span><span class="s">&quot;)&quot;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">(</span><span class="o">&lt;&gt;</span><span class="p">),</span><span class="w"></span>
<span class="p">};</span><span class="w"></span>

<span class="n">VarUsesRegion</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;var_uses_region&quot;</span><span class="w"> </span><span class="s">&quot;{&quot;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">VarRegionMappings</span><span class="o">&gt;</span><span class="w"> </span><span class="s">&quot;}&quot;</span><span class="p">;</span><span class="w"></span>
<span class="n">VarDropsRegion</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="s">&quot;var_drops_region&quot;</span><span class="w"> </span><span class="s">&quot;{&quot;</span><span class="w"> </span><span class="o">&lt;</span><span class="n">VarRegionMappings</span><span class="o">&gt;</span><span class="w"> </span><span class="s">&quot;}&quot;</span><span class="p">;</span><span class="w"></span>
</pre></div>


<p>But how do I add this in an order-independent way to <code>Input</code>?</p>



<a name="166183579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166183579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166183579">(May 21 2019 at 15:35)</a>:</h4>
<p>don't add it in an order-independent way then :) just putting these after the <code>universal_regions {}</code> will probably be simpler ?</p>



<a name="166186371"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166186371" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166186371">(May 21 2019 at 16:05)</a>:</h4>
<blockquote>
<p>don't add it in an order-independent way then :) just putting these after the <code>universal_regions {}</code> will probably be simpler ?</p>
</blockquote>
<p>Could you expand on that? I mean, I can do something like:</p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="n">Input</span>: <span class="nc">Input</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">universal_regions</span>:<span class="nc">UniversalRegions</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">var_uses_region</span>:<span class="nc">VarUsesRegion</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">var_drops_region</span>:<span class="nc">VarDropsRegion</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">blocks</span>:<span class="nc">BlockDefn</span><span class="o">*&gt;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">Input</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&lt;&gt;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">};</span><span class="w"></span>
</pre></div>


<p>but that would both require them to be present and in that order.</p>



<a name="166187313"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166187313" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166187313">(May 21 2019 at 16:17)</a>:</h4>
<p>Ok, so I made them optional by adding <code>?</code>:s, and then creating a constructor for <code>Input</code> like this:</p>
<div class="codehilite"><pre><span></span><span class="k">impl</span><span class="w"> </span><span class="n">Input</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">pub</span><span class="w"> </span><span class="k">fn</span> <span class="nf">new</span><span class="p">(</span><span class="w"></span>
<span class="w">        </span><span class="n">universal_regions</span>: <span class="nb">Vec</span><span class="o">&lt;</span><span class="nb">String</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">var_uses_region</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="nb">Vec</span><span class="o">&lt;</span><span class="p">(</span><span class="nb">String</span><span class="p">,</span><span class="w"> </span><span class="nb">String</span><span class="p">)</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">var_drops_region</span>: <span class="nb">Option</span><span class="o">&lt;</span><span class="nb">Vec</span><span class="o">&lt;</span><span class="p">(</span><span class="nb">String</span><span class="p">,</span><span class="w"> </span><span class="nb">String</span><span class="p">)</span><span class="o">&gt;&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="n">blocks</span>: <span class="nb">Vec</span><span class="o">&lt;</span><span class="n">Block</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Input</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">Input</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">universal_regions</span><span class="p">,</span><span class="w"></span>
<span class="w">            </span><span class="n">var_uses_region</span>: <span class="nc">var_uses_region</span><span class="p">.</span><span class="n">unwrap_or</span><span class="p">(</span><span class="nb">Vec</span>::<span class="n">default</span><span class="p">()),</span><span class="w"></span>
<span class="w">            </span><span class="n">var_drops_region</span>: <span class="nc">var_drops_region</span><span class="p">.</span><span class="n">unwrap_or</span><span class="p">(</span><span class="nb">Vec</span>::<span class="n">default</span><span class="p">()),</span><span class="w"></span>
<span class="w">            </span><span class="n">blocks</span><span class="p">,</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>


<p>and using</p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="n">Input</span>: <span class="nc">Input</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">universal_regions</span>:<span class="nc">UniversalRegions</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">var_uses_region</span>:<span class="nc">VarUsesRegion</span><span class="o">?&gt;</span><span class="w"> </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">var_drops_region</span>:<span class="nc">VarDropsRegion</span><span class="o">?&gt;</span><span class="w"> </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">blocks</span>:<span class="nc">BlockDefn</span><span class="o">*&gt;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">Input</span>::<span class="n">new</span><span class="p">(</span><span class="o">&lt;&gt;</span><span class="p">)</span><span class="w"></span>
<span class="p">};</span><span class="w"></span>
</pre></div>


<p>in the grammar.</p>
<p>It feels very clunky,  is there a better way?</p>



<a name="166188554"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166188554" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166188554">(May 21 2019 at 16:32)</a>:</h4>
<p>there probably is a better way, using lalrpop better, but even if the order is fixed like so, it's at least acceptable for now ? (and at least unblocks you until then, and at least these test programs have an always consistent syntax albeit inflexible)</p>



<a name="166188712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166188712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166188712">(May 21 2019 at 16:34)</a>:</h4>
<p>there can probably exist a larlpop macro/combinator where we could pass these parts and it would combine them, with optional comments in-between (possibly in an order-independent way) as the program header before the cfg blocks</p>



<a name="166188784"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166188784" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166188784">(May 21 2019 at 16:35)</a>:</h4>
<p>(similarly to the <code>Comma</code> combinator, at least if one ignores the order-independence part -- update: hmm maybe not)</p>



<a name="166189375"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166189375" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166189375">(May 21 2019 at 16:44)</a>:</h4>
<p>a lot of the more flexible uses of lalrpop seem to involve a custom lexer eg <a href="https://github.com/lalrpop/lalrpop/issues/14" target="_blank" title="https://github.com/lalrpop/lalrpop/issues/14">https://github.com/lalrpop/lalrpop/issues/14</a> -- then again, I'm not super familiar with it</p>



<a name="166193533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166193533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166193533">(May 21 2019 at 17:32)</a>:</h4>
<p>for an example of order-independence and optional relations, something like this could be done: 1) introduce an enum to unify the relations <code>universal_regions { ... }</code>, <code>var_uses_region { ... }</code>, and <code>var_drops_region { ... }</code> 2) make <code>Input</code> take a list of these "directives" instead of the <code>universal_regions</code> Vec (and either only have a list of directives in <code>Input</code>, or distribute them into your 3 inner Vecs in a new <code>Input::new</code> fn)</p>



<a name="166193647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166193647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166193647">(May 21 2019 at 17:32)</a>:</h4>
<p>like</p>
<div class="codehilite"><pre><span></span><span class="k">pub</span><span class="w"> </span><span class="n">Input</span>: <span class="nc">Input</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="o">&lt;</span><span class="n">directives</span>:<span class="nc">ProgramDirective</span><span class="o">*&gt;</span><span class="w"> </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">blocks</span>:<span class="nc">BlockDefn</span><span class="o">*&gt;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">Input</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="o">&lt;&gt;</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="p">};</span><span class="w"></span>

<span class="n">ProgramDirective</span><span class="w"> </span>: <span class="nc">ProgramDirective</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">UniversalRegions</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">ProgramDirective</span>::<span class="n">UniversalRegions</span><span class="p">(</span><span class="o">&lt;&gt;</span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">VarUsesRegion</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">ProgramDirective</span>::<span class="n">VarUsesRegion</span><span class="p">(</span><span class="o">&lt;&gt;</span><span class="p">),</span><span class="w"></span>
<span class="w">    </span><span class="n">Comment</span><span class="o">*</span><span class="w"> </span><span class="o">&lt;</span><span class="n">VarDropsRegion</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">ProgramDirective</span>::<span class="n">VarDropsRegion</span><span class="p">(</span><span class="o">&lt;&gt;</span><span class="p">),</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="166193907"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166193907" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166193907">(May 21 2019 at 17:35)</a>:</h4>
<p>3) if needed, add some validation to the root parsing fn to ensure these program directives are valid, for example, say, "there must be a universal_regions directive even if it's empty" and the likes which could apply to the other 2 relations</p>



<a name="166242987"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166242987" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166242987">(May 22 2019 at 07:13)</a>:</h4>
<p>Hm, that sounds like a perfectly OK approach too, but I'm not sure it's sufficiently better than what I have to warrant the even more complicated implementation, so I think I'll let it be. At least now all the tests are passing, which is mostly what I was aiming for. :)</p>



<a name="166243044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166243044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166243044">(May 22 2019 at 07:14)</a>:</h4>
<p>Ugh, I <em>swear</em> this worked yesterday, but today I'm getting shift-reduce conflicts???</p>



<a name="166243358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166243358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166243358">(May 22 2019 at 07:21)</a>:</h4>
<p>Ah, Ok it's the interspersed <code>Comment*</code> between the statements</p>



<a name="166243364"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166243364" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166243364">(May 22 2019 at 07:21)</a>:</h4>
<p>I can...live without that</p>



<a name="166572461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166572461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166572461">(May 26 2019 at 12:10)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Ok I have done a more thorough investigation of what's different between the output of rustc and polonius for liveness (after tweaking the output of which variables get drop-use-emitted when. First, what's going on in the test is that a moved value is explicitly dropped:</p>
<div class="codehilite"><pre><span></span><span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">wrap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Wrap</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">p</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="c1">// Wrap impls Drop</span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">String</span>::<span class="n">from</span><span class="p">(</span><span class="s">&quot;str&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">a</span>: <span class="nc">s</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">wrap</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="c1">// Foo does not</span>
<span class="w">    </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">drop</span><span class="p">(</span><span class="n">foo</span><span class="p">.</span><span class="n">a</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">drop</span><span class="p">(</span><span class="n">foo</span><span class="p">.</span><span class="n">b</span><span class="p">);</span><span class="w"></span>
</pre></div>


<p>The interesting MIR blocks are, I think, these:</p>
<div class="codehilite"><pre><span></span><span class="n">bb2</span>: <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">FakeRead</span><span class="p">(</span><span class="n">ForLet</span><span class="p">,</span><span class="w"> </span><span class="n">_5</span><span class="p">);</span><span class="w">            </span><span class="c1">// bb2[0]: scope 4 at maybe-initialized-drop-with-uninitialized-fragments.rs:18:9: 18:10</span>
<span class="w">        </span><span class="n">StorageLive</span><span class="p">(</span><span class="n">_6</span><span class="p">);</span><span class="w">                 </span><span class="c1">// bb2[1]: scope 6 at maybe-initialized-drop-with-uninitialized-fragments.rs:19:9: 19:12</span>
<span class="w">        </span><span class="n">StorageLive</span><span class="p">(</span><span class="n">_7</span><span class="p">);</span><span class="w">                 </span><span class="c1">// bb2[2]: scope 6 at maybe-initialized-drop-with-uninitialized-fragments.rs:19:24: 19:25</span>
<span class="w">        </span><span class="n">_7</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">move</span><span class="w"> </span><span class="n">_5</span><span class="p">;</span><span class="w">                    </span><span class="c1">// bb2[3]: scope 6 at maybe-initialized-drop-with-uninitialized-fragments.rs:19:24: 19:25</span>
<span class="w">        </span><span class="n">StorageLive</span><span class="p">(</span><span class="n">_8</span><span class="p">);</span><span class="w">                 </span><span class="c1">// bb2[4]: scope 6 at maybe-initialized-drop-with-uninitialized-fragments.rs:19:30: 19:34</span>
<span class="w">        </span><span class="n">_8</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">move</span><span class="w"> </span><span class="n">_2</span><span class="p">;</span><span class="w">                    </span><span class="c1">// bb2[5]: scope 6 at maybe-initialized-drop-with-uninitialized-fragments.rs:19:30: 19:34</span>
<span class="w">        </span><span class="n">_6</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span>::<span class="o">&lt;</span><span class="na">&#39;_</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">a</span>: <span class="nc">move</span><span class="w"> </span><span class="n">_7</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">move</span><span class="w"> </span><span class="n">_8</span><span class="w"> </span><span class="p">};</span><span class="w"> </span><span class="c1">// bb2[6]: scope 6 at maybe-initialized-drop-with-uninitialized-fragments.rs:19:15: 19:36</span>
<span class="w">        </span><span class="n">drop</span><span class="p">(</span><span class="n">_8</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">[</span><span class="k">return</span>: <span class="nc">bb6</span><span class="p">,</span><span class="w"> </span><span class="n">unwind</span>: <span class="nc">bb5</span><span class="p">];</span><span class="w"> </span><span class="c1">// bb2[7]: scope 6 at maybe-initialized-drop-with-uninitialized-fragments.rs:19:35: 19:36</span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>


<span class="w">    </span><span class="n">bb3</span><span class="w"> </span><span class="p">(</span><span class="n">cleanup</span><span class="p">)</span>: <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">drop</span><span class="p">(</span><span class="n">_2</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">bb1</span><span class="p">;</span><span class="w">                 </span><span class="c1">// bb3[0]: scope 2 at maybe-initialized-drop-with-uninitialized-fragments.rs:24:1: 24:2</span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>What rustc emits in terms of region liveness for <code>_2</code>/<code>_8</code>'s region is that it gets drop-used at the move, <code>Mid(bb2[5])</code>. It's also live in the single line of the <code>bb3</code> block, but this doesn't propagate to the other blocks that precede it as it should according to the rules.</p>
<p>In other words, I think there is something more advanced related to initialisation tracking going on here, and it's perhaps best to just let it be and fix initialisation tracking in stead? It's worth noting that leaving it as it is doesn't break any compile-tests.</p>



<a name="166572577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166572577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166572577">(May 26 2019 at 12:14)</a>:</h4>
<p>I should perhaps also mention that <code>_8</code>, which is the moved copy of <code>_2</code>gets a new region. This is then solved by a mutual outlives relationship that of course means is equal, but we don't know that when generating <code>region_live_at</code>.</p>



<a name="166572636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166572636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166572636">(May 26 2019 at 12:16)</a>:</h4>
<p>I'm not sure if there's a case to be made for inital de-duplication of these equivalent regions or if you're already doing that</p>



<a name="166577252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166577252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166577252">(May 26 2019 at 14:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I also have a theoretical question. In the literature, there is a lot of talk about "context-sensitive analysis", but a "context" seems very broad. Given that Polonius takes literal lines of intermediate representation into account, does that make the analysis context-sensitive?</p>



<a name="166580094"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166580094" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166580094">(May 26 2019 at 15:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Also, I am a bit unclear about what precisely happens when we generate <code>var_uses_region</code>and <code>var_drops_region</code>. What precisely does it mean that a given region occurs in a referece's type? How does this interact with, say, indirect/nested references?</p>



<a name="166580954"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166580954" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166580954">(May 26 2019 at 15:59)</a>:</h4>
<p>A region occurs in a type if it</p>
<ul>
<li>Is one of the type's region parameters (this include the region for references)</li>
<li>It occurs in one of the type's type parameters<br>
<code>tcx.for_each_free_region(&amp;value, |region| { r })</code> will call the closure for each region that occurs in the type, although it won't deduplicate regions.</li>
</ul>



<a name="166581178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166581178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166581178">(May 26 2019 at 16:05)</a>:</h4>
<blockquote>
<p>In other words, I think there is something more advanced related to initialisation tracking going on here, and it's perhaps best to just let it be and fix initialisation tracking in stead? It's worth noting that leaving it as it is doesn't break any compile-tests</p>
</blockquote>
<p>Liveness in NLL does use initialization results to reduce the amount of time that variable are live. I think that this can just be left for now.<br>
We should have a test for this in the rustc test suite, but it's possible that polonius circumvents the test.</p>



<a name="166581234"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166581234" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166581234">(May 26 2019 at 16:06)</a>:</h4>
<p>Are you generating <code>var_uses_region</code> and <code>var_drops_region</code> facts at the moment?</p>



<a name="166626712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166626712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166626712">(May 27 2019 at 10:50)</a>:</h4>
<blockquote>
<p>Liveness in NLL does use initialization results to reduce the amount of time that variable are live. I think that this can just be left for now.<br>
We should have a test for this in the rustc test suite, but it's possible that polonius circumvents the test</p>
</blockquote>
<p>I'm talking about the Polonius-internal tests that only verify that Polonius <code>region_live_at</code>is the same as the one given by Rustc (which it currently isn't always). I wrote those. :)</p>



<a name="166626844"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166626844" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166626844">(May 27 2019 at 10:53)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span>  </p>
<blockquote>
<p>Are you generating <code>var_uses_region</code> and <code>var_drops_region</code> facts at the moment?</p>
</blockquote>
<p>Yes! In <code>trace::add_drop_live_facts_for</code>,  I have:</p>
<div class="codehilite"><pre><span></span><span class="w">       </span><span class="c1">// All things in the `outlives` array may be touched by</span>
<span class="w">        </span><span class="c1">// the destructor and must be live at this point.</span>
<span class="w">        </span><span class="k">for</span><span class="w"> </span><span class="o">&amp;</span><span class="n">kind</span><span class="w"> </span><span class="k">in</span><span class="w"> </span><span class="o">&amp;</span><span class="n">drop_data</span><span class="p">.</span><span class="n">dropck_result</span><span class="p">.</span><span class="n">kinds</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">Self</span>::<span class="n">make_all_regions_live</span><span class="p">(</span><span class="bp">self</span><span class="p">.</span><span class="n">elements</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">typeck</span><span class="p">,</span><span class="w"> </span><span class="n">kind</span><span class="p">,</span><span class="w"> </span><span class="n">live_at</span><span class="p">);</span><span class="w"></span>

<span class="w">            </span><span class="n">polonius</span>::<span class="n">add_var_drops_regions</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">typeck</span><span class="p">,</span><span class="w"> </span><span class="n">dropped_local</span><span class="p">,</span><span class="w"> </span><span class="o">&amp;</span><span class="n">kind</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
</pre></div>


<p>and then:</p>
<div class="codehilite"><pre><span></span><span class="c1">// For every potentially drop()-touched region `region` in `local`&#39;s type</span>
<span class="c1">// (`kind`), emit a Polonius `var_drops_region(local, region)` fact.</span>
<span class="k">pub</span><span class="p">(</span><span class="k">super</span><span class="p">)</span><span class="w"> </span><span class="k">fn</span> <span class="nf">add_var_drops_regions</span><span class="p">(</span><span class="w"></span>
<span class="w">    </span><span class="n">typeck</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">TypeChecker</span><span class="o">&lt;</span><span class="na">&#39;_</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;_</span><span class="p">,</span><span class="w"> </span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">local</span>: <span class="nc">Local</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">kind</span>: <span class="kp">&amp;</span><span class="nc">Kind</span><span class="o">&lt;</span><span class="na">&#39;tcx</span><span class="o">&gt;</span><span class="p">,</span><span class="w"></span>
<span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">tcx</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">typeck</span><span class="p">.</span><span class="n">tcx</span><span class="p">();</span><span class="w"></span>

<span class="w">    </span><span class="n">tcx</span><span class="p">.</span><span class="n">for_each_free_region</span><span class="p">(</span><span class="n">kind</span><span class="p">,</span><span class="w"> </span><span class="o">|</span><span class="n">drop_live_region</span><span class="o">|</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="kd">let</span><span class="w"> </span><span class="n">region_vid</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">typeck</span><span class="p">.</span><span class="n">borrowck_context</span><span class="p">.</span><span class="n">universal_regions</span><span class="p">.</span><span class="n">to_region_vid</span><span class="p">(</span><span class="n">drop_live_region</span><span class="p">);</span><span class="w"></span>
<span class="w">        </span><span class="k">if</span><span class="w"> </span><span class="kd">let</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">facts</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">typeck</span><span class="p">.</span><span class="n">borrowck_context</span><span class="p">.</span><span class="n">all_facts</span><span class="p">.</span><span class="n">as_mut</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="n">facts</span><span class="p">.</span><span class="n">var_drops_region</span><span class="p">.</span><span class="n">push</span><span class="p">((</span><span class="n">local</span><span class="p">,</span><span class="w"> </span><span class="n">region_vid</span><span class="p">));</span><span class="w"></span>
<span class="w">        </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="p">});</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="166627207"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166627207" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166627207">(May 27 2019 at 10:59)</a>:</h4>
<blockquote>
<p>A region occurs in a type if it</p>
<ul>
<li>Is one of the type's region parameters (this include the region for references)</li>
<li>It occurs in one of the type's type parameters</li>
</ul>
</blockquote>
<p>OK, so the latter one takes care of the reference to reference situation, where we might have a reference to a reference to a reference with region <code>'x</code>. Got it!</p>



<a name="166718356"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166718356" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166718356">(May 28 2019 at 13:46)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> I'm not entirely clear on which questions remain unresolved here --</p>



<a name="166718442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166718442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166718442">(May 28 2019 at 13:46)</a>:</h4>
<p>as <span class="user-mention" data-user-id="116118">@Matthew Jasper</span> said, we do take initialization into account, I think you and I discussed this earlier. When it comes to polonius, I would probably prefer to wait on that part because computing "initialization" is in fact the next thing we should be doing (perhaps starting this week?) and so it would make sense to incorporate that afterwards.</p>



<a name="166718466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166718466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166718466">(May 28 2019 at 13:47)</a>:</h4>
<p>Probably you and me should schedule some kind of (recorded) zoom session to talk over the next steps</p>



<a name="166718624"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166718624" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166718624">(May 28 2019 at 13:48)</a>:</h4>
<p>(re: parsing, the way to do this would be to accept the directives in any order, and then enforce any "occurs at most once" restrictions in the action code, I suppose)</p>



<a name="166725546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166725546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166725546">(May 28 2019 at 15:05)</a>:</h4>
<blockquote>
<p>(re: parsing, the way to do this would be to accept the directives in any order, and then enforce any "occurs at most once" restrictions in the action code, I suppose)</p>
</blockquote>
<p>I pushed a stupid version that enforces ordering for now, but that's probably a better long-term solution.</p>



<a name="166726001"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166726001" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166726001">(May 28 2019 at 15:10)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="204115">Albin Stjerna</span> I'm not entirely clear on which questions remain unresolved here --</p>
</blockquote>
<p>Errm, hardly surprising. I think you can treat most of this as resolved for now. What seems to have happened is that I figured that for some edge cases we will probably need proper initialisation analysis in Polonius to get the same <code>region_live_at</code> output as rustc.</p>
<p>I think we should be starting with initialisation this week, and I guess we should start merging the liveness logic as-is?</p>



<a name="166726399"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166726399" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166726399">(May 28 2019 at 15:14)</a>:</h4>
<p>sounds correct to me</p>



<a name="166726405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166726405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166726405">(May 28 2019 at 15:14)</a>:</h4>
<p>I guess we need to merge the polonius code first?</p>



<a name="166726425"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166726425" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166726425">(May 28 2019 at 15:15)</a>:</h4>
<p>well, we can sync up later today I guess and figure this out, I'm kind of busy until then</p>



<a name="166738905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166738905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166738905">(May 28 2019 at 17:25)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Sounds good; I was busy too</p>



<a name="166739052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166739052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166739052">(May 28 2019 at 17:26)</a>:</h4>
<p>Also, <a href="/user_uploads/4715/8c9NtpnaseENB85NR_mJM-Dh/pasted_image.png" target="_blank" title="pasted_image.png">this is what the liveness graph output I'm working on looks like now</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/8c9NtpnaseENB85NR_mJM-Dh/pasted_image.png" target="_blank" title="this is what the liveness graph output I'm working on looks like now"><img src="/user_uploads/4715/8c9NtpnaseENB85NR_mJM-Dh/pasted_image.png"></a></div>



<a name="166739111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166739111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166739111">(May 28 2019 at 17:27)</a>:</h4>
<p>I'm planning on giving the liveness edges different colours for each variable, but err this is a work-in-progress</p>



<a name="166739124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166739124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166739124">(May 28 2019 at 17:27)</a>:</h4>
<p>Also, reduction of non-interesting nodes is sorely needed as you can see</p>



<a name="166896966"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166896966" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166896966">(May 30 2019 at 10:45)</a>:</h4>
<p><a href="/user_uploads/4715/wOYZKPGD69o4cPNZSA_ggFQe/pasted_image.png" target="_blank" title="pasted_image.png">now I have the facts as well</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/wOYZKPGD69o4cPNZSA_ggFQe/pasted_image.png" target="_blank" title="now I have the facts as well"><img src="/user_uploads/4715/wOYZKPGD69o4cPNZSA_ggFQe/pasted_image.png"></a></div>



<a name="166980508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166980508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166980508">(May 31 2019 at 09:06)</a>:</h4>
<p>Ok; now the full graph reduction thing works, which means that it joins nodes in the graph where liveness doesn't change and control flow just moves forward: <a href="/user_uploads/4715/TSrsje0RF3GB_-Q31P9js8_A/pasted_image.png" target="_blank" title="pasted_image.png">example</a>  and <a href="/user_uploads/4715/nh53YIELSwzzow0kFsa1ARpf/pasted_image.png" target="_blank" title="pasted_image.png">other example</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/TSrsje0RF3GB_-Q31P9js8_A/pasted_image.png" target="_blank" title="example"><img src="/user_uploads/4715/TSrsje0RF3GB_-Q31P9js8_A/pasted_image.png"></a></div><div class="message_inline_image"><a href="/user_uploads/4715/nh53YIELSwzzow0kFsa1ARpf/pasted_image.png" target="_blank" title="other example"><img src="/user_uploads/4715/nh53YIELSwzzow0kFsa1ARpf/pasted_image.png"></a></div>



<a name="166980541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/166980541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#166980541">(May 31 2019 at 09:07)</a>:</h4>
<p>I had to pull in the petgraph library for DFS though, and do a few...less than beautiful things</p>



<a name="167002587"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167002587" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167002587">(May 31 2019 at 14:41)</a>:</h4>
<p>Update: <a href="/user_uploads/4715/BRtOJ3kKLvpQi7tIN7BRhPBh/pasted_image.png" target="_blank" title="pasted_image.png">now with rainbows</a>.</p>
<div class="message_inline_image"><a href="/user_uploads/4715/BRtOJ3kKLvpQi7tIN7BRhPBh/pasted_image.png" target="_blank" title="now with rainbows"><img src="/user_uploads/4715/BRtOJ3kKLvpQi7tIN7BRhPBh/pasted_image.png"></a></div>



<a name="167002774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167002774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167002774">(May 31 2019 at 14:43)</a>:</h4>
<p>Also, emoji to save space. <span aria-label="drop" class="emoji emoji-1f4a7" role="img" title="drop">:drop:</span> = var_drop_used, <span aria-label="fixing" class="emoji emoji-1f527" role="img" title="fixing">:fixing:</span> = var_used, <span aria-label="skull and crossbones" class="emoji emoji-2620" role="img" title="skull and crossbones">:skull_and_crossbones:</span>️ = var_defined</p>



<a name="167061911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167061911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167061911">(Jun 01 2019 at 08:15)</a>:</h4>
<p><span class="user-group-mention" data-user-group-id="1184">@WG-polonius</span> Would it be OK to pull in <a href="https://crates.io/crates/petgraph" target="_blank" title="https://crates.io/crates/petgraph">petgraph</a> as a dependency in polonius-the-binary (not polonius-engine)?</p>



<a name="167062113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167062113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167062113">(Jun 01 2019 at 08:20)</a>:</h4>
<p>for the binary I myself think it’d be ok</p>



<a name="167068620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167068620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167068620">(Jun 01 2019 at 11:31)</a>:</h4>
<blockquote>
<p>for the binary I myself think it’d be ok</p>
</blockquote>
<p>yes, for polonius it's ok, not polonius-engine</p>



<a name="167069271"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167069271" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167069271">(Jun 01 2019 at 11:51)</a>:</h4>
<p>Good, that's what I thought</p>



<a name="167069277"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167069277" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167069277">(Jun 01 2019 at 11:51)</a>:</h4>
<p>Then I'll make a separate PR of those after the liveness PR is merged</p>



<a name="167069320"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167069320" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167069320">(Jun 01 2019 at 11:52)</a>:</h4>
<p>Because I genuinely think it might be useful for debugging</p>



<a name="167232990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167232990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167232990">(Jun 03 2019 at 21:16)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> is <a href="https://github.com/rust-lang/polonius/pull/105/" target="_blank" title="https://github.com/rust-lang/polonius/pull/105/">https://github.com/rust-lang/polonius/pull/105/</a> ready for review / ready to land?</p>



<a name="167233055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167233055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167233055">(Jun 03 2019 at 21:17)</a>:</h4>
<p>hmm that's a painful one to review :)</p>



<a name="167233181"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167233181" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167233181">(Jun 03 2019 at 21:19)</a>:</h4>
<p>is the +1,347,366 −1,345,277 expected btw ?</p>



<a name="167233266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167233266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167233266">(Jun 03 2019 at 21:20)</a>:</h4>
<p>(seems a bit high, even if modifying many input facts)</p>



<a name="167233539"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167233539" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167233539">(Jun 03 2019 at 21:24)</a>:</h4>
<p>not sure :)</p>



<a name="167272918"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167272918" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167272918">(Jun 04 2019 at 09:09)</a>:</h4>
<p>yeah, seems like all the facts were regenerated, I'm surprised they are so different to cause such a big diff — but I guess it makes sense since the ones in the repo are fairly old (and the "NLL MIR" has changed since they were initially generated) but I hope they're not regressing. For example, as clap is not unit tested, it would be nice to be sure the new facts produce the same errors as the old ones. It's a bit of a chicken and egg situation, as rustc and polonius bootstrap each other here, creating big diffs for the facts especially over a longer period of time. I also wonder how much of rustc's tests should we integrate in Polonius in general (vs rustc's polonius compare mode), and under the form of facts in particular (vs, say, generating them just in time in the tests, in memory or .gitignored).</p>



<a name="167275693"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167275693" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167275693">(Jun 04 2019 at 09:46)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> It should be ready to merge, except for an entry in the Changelog, but I plan on writing that from the circulation desk later today. I'll let you know when it's done!</p>



<a name="167275771"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167275771" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167275771">(Jun 04 2019 at 09:46)</a>:</h4>
<blockquote>
<p>is the +1,347,366 −1,345,277 expected btw ?</p>
</blockquote>
<p><span class="user-mention" data-user-id="116113">@lqd</span> I'm also adding new input facts, but yes, in hindsight this maybe wasn't a great idea.</p>



<a name="167276004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167276004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167276004">(Jun 04 2019 at 09:49)</a>:</h4>
<blockquote>
<p>yeah, seems like all the facts were regenerated, I'm surprised they are so different to cause such a big diff — but I guess it makes sense since the ones in the repo are fairly old (and the "NLL MIR" has changed since they were initially generated) but I hope they're not regressing.</p>
</blockquote>
<p>Almost all of them, some of the facts caused hard-coded point IDs to change in the MIR and I kept the old facts. This also means that the <code>var_used_at</code>and all the other new facts are actually inconsistent with the other facts in the same folder, but it's fine as they are ignored and the liveness analysis bypassed when there is an existing <code>region_live_at</code>fact set.</p>



<a name="167276110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167276110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167276110">(Jun 04 2019 at 09:50)</a>:</h4>
<p>But yes, in the future I think I should keep the PRs smaller and the merge windows shorter than this, in particular for rustc</p>



<a name="167276185"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167276185" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167276185">(Jun 04 2019 at 09:51)</a>:</h4>
<p>chicken and egg, sometimes you need new facts for tests, or to update an existing one such as clap (which is likely be the vast majority of the change here) it’s a bit unfortunate but I’m not sure it would have been easy/possible to avoid for you in any case</p>



<a name="167276346"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167276346" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167276346">(Jun 04 2019 at 09:53)</a>:</h4>
<p>could be an interesting topic for tonight ?</p>



<a name="167276561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167276561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167276561">(Jun 04 2019 at 09:55)</a>:</h4>
<p>Yes!</p>



<a name="167283324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167283324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167283324">(Jun 04 2019 at 11:40)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Ok DONE, I think. I just updated RELEASES on my branch</p>



<a name="167307794"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167307794" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167307794">(Jun 04 2019 at 15:51)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> thanks</p>



<a name="167332489"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167332489" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167332489">(Jun 04 2019 at 20:21)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Should I do something similar to my commits to Rust?</p>



<a name="167332561"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167332561" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167332561">(Jun 04 2019 at 20:22)</a>:</h4>
<p>It's less messy than Polonius, but I didn't go out of my way to curate the history as the commits seem to get squashed on merge anyways?</p>



<a name="167336021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167336021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167336021">(Jun 04 2019 at 21:08)</a>:</h4>
<p>yes please</p>



<a name="167336048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167336048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167336048">(Jun 04 2019 at 21:08)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> I haven't actually looked but a messy history can be a real pain</p>



<a name="167336050"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167336050" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167336050">(Jun 04 2019 at 21:08)</a>:</h4>
<p>of course if I just view "all diffs" it's fine</p>



<a name="167336053"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167336053" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167336053">(Jun 04 2019 at 21:08)</a>:</h4>
<p>it mostly matters if the full set of diffs is large</p>



<a name="167363210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167363210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167363210">(Jun 05 2019 at 07:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I take that back, I think the commit log looks all right except that I still regret that rustfmt a bit</p>



<a name="167365945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167365945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167365945">(Jun 05 2019 at 07:58)</a>:</h4>
<p><a href="https://github.com/rust-lang-nursery/polonius/issues/105" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/105">polonius#105</a> seems to be missing the <code>liveness.rs</code> file</p>



<a name="167389297"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167389297" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167389297">(Jun 05 2019 at 13:41)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> <span aria-label="point up" class="emoji emoji-1f446" role="img" title="point up">:point_up:</span></p>



<a name="167393145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167393145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167393145">(Jun 05 2019 at 14:21)</a>:</h4>
<p>Err wooops</p>



<a name="167393393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167393393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167393393">(Jun 05 2019 at 14:23)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Fixed!</p>



<a name="167393512"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167393512" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167393512">(Jun 05 2019 at 14:24)</a>:</h4>
<p>I <span aria-label="heart" class="emoji emoji-2764" role="img" title="heart">:heart:</span> the "boring" and "fun" commit btw :)</p>



<a name="167393661"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167393661" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167393661">(Jun 05 2019 at 14:26)</a>:</h4>
<p>The naming or the general concept?</p>



<a name="167608072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167608072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167608072">(Jun 07 2019 at 19:50)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> merged, published</p>



<a name="167608178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167608178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167608178">(Jun 07 2019 at 19:50)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Yay! I'll finalise rustc now :)</p>



<a name="167609446"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167609446" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167609446">(Jun 07 2019 at 20:06)</a>:</h4>
<p>about that, I was thinking, since we don't quite match rustc's <code>region_live_at</code> generation yet, maybe we should only remove this relation facts' generation from rustc after move/overwrite has been integrated, so we can <em>then</em> ensure we do match it ? I mean, maybe we don't do <a href="https://github.com/rust-lang/rust/pull/60266/commits/f275292d3e34fb83a98c2bef0aae383e22880fac" target="_blank" title="https://github.com/rust-lang/rust/pull/60266/commits/f275292d3e34fb83a98c2bef0aae383e22880fac">this commit</a> yet, what do you think ? (or maybe it's not that easy/worthwhile ?)</p>



<a name="167610055"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610055" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610055">(Jun 07 2019 at 20:13)</a>:</h4>
<p>Hmm. It does make sense I guess, but we also have the recorded facts to compare with, but those could of course go stale</p>



<a name="167610134"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610134" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610134">(Jun 07 2019 at 20:14)</a>:</h4>
<p>Other than that, <a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">rust#60266</a> should be ready to merge</p>



<a name="167610182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610182">(Jun 07 2019 at 20:14)</a>:</h4>
<p>true; just a thought as it's hard to check correctness as you've no doubt seen :)</p>



<a name="167610204"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610204" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610204">(Jun 07 2019 at 20:15)</a>:</h4>
<p>Err, yes</p>



<a name="167610224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610224">(Jun 07 2019 at 20:15)</a>:</h4>
<p>Ideally I'd like to have an option to turn it on, but I don't know the policy on that</p>



<a name="167610535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610535">(Jun 07 2019 at 20:19)</a>:</h4>
<p>initialization/move/overwrite shouldn't take close as long, so maybe the new recorded facts would be enough indeed</p>



<a name="167610714"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610714" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610714">(Jun 07 2019 at 20:21)</a>:</h4>
<p>I <em>think</em> (but unsure about the procedure about triage) that the PR can also be marked <code>S-waiting-on-review</code> instead of <code>S-waiting-on-author</code></p>



<a name="167610799"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610799" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610799">(Jun 07 2019 at 20:22)</a>:</h4>
<p>Feel free to remark as waiting-on-review if the author feels that way</p>



<a name="167610815"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610815" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610815">(Jun 07 2019 at 20:22)</a>:</h4>
<p>basically if the author is, in fact, waiting on review then that's the right status :)</p>



<a name="167610825"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610825" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610825">(Jun 07 2019 at 20:22)</a>:</h4>
<p>:)</p>



<a name="167610910"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167610910" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167610910">(Jun 07 2019 at 20:23)</a>:</h4>
<p>done <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> — thanks <span class="user-mention" data-user-id="116122">@simulacrum</span> :)</p>



<a name="167784333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167784333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167784333">(Jun 10 2019 at 18:37)</a>:</h4>
<p>Can we emit both sets of facts and have polonius configurable as to whether or not to use them?</p>



<a name="167784348"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167784348" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167784348">(Jun 10 2019 at 18:37)</a>:</h4>
<p>e.g. by selecting which algorithm perhaps?</p>



<a name="167784360"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167784360" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167784360">(Jun 10 2019 at 18:37)</a>:</h4>
<p>naive, naive-liveness, something like that</p>



<a name="167788328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167788328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167788328">(Jun 10 2019 at 19:25)</a>:</h4>
<p>sounds feasible</p>



<a name="167795746"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167795746" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167795746">(Jun 10 2019 at 20:56)</a>:</h4>
<p>Hmm, <span class="user-mention" data-user-id="204115">@Albin Stjerna</span>, I just skimmed <a href="https://github.com/rust-lang/rust/pull/60266/" target="_blank" title="https://github.com/rust-lang/rust/pull/60266/">https://github.com/rust-lang/rust/pull/60266/</a> -- I'm trying to remember -- that code <em>is</em> (at least sort of) taking initialization into account when generating <code>var_drop_used</code> facts, though it's leveraging rustc to do that generation ... but we are still seeing discrepancies in the results? I can't remember if we tracked that down or not.</p>



<a name="167798193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798193">(Jun 10 2019 at 21:28)</a>:</h4>
<blockquote>
<p>e.g. by selecting which algorithm perhaps?</p>
</blockquote>
<p>The easiest way is just to either not populate the <code>region_live_at</code> input or delete it to begin with I think, but yes, that's not difficult.</p>



<a name="167798244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798244">(Jun 10 2019 at 21:28)</a>:</h4>
<blockquote>
<p>Hmm, <span class="user-mention silent" data-user-id="204115">Albin Stjerna</span>, I just skimmed <a href="https://github.com/rust-lang/rust/pull/60266/" target="_blank" title="https://github.com/rust-lang/rust/pull/60266/">https://github.com/rust-lang/rust/pull/60266/</a> -- I'm trying to remember -- that code <em>is</em> (at least sort of) taking initialization into account when generating <code>var_drop_used</code> facts, though it's leveraging rustc to do that generation ... but we are still seeing discrepancies in the results? I can't remember if we tracked that down or not.</p>
</blockquote>
<p>Yes, and I know. It's weird. I did a run-down of the differences, and they really were minor, but I don't understand it either.</p>



<a name="167798272"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798272" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798272">(Jun 10 2019 at 21:29)</a>:</h4>
<p>Hmm, ok. I wonder if we should try to dig into this a bit deeper.</p>



<a name="167798284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798284">(Jun 10 2019 at 21:29)</a>:</h4>
<p>(Have you taken a look at the other initialization-tracking code at all?)</p>



<a name="167798357"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798357" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798357">(Jun 10 2019 at 21:30)</a>:</h4>
<p>Not yet, I have been working on my presentation. And also just been very inefficient lately, I honestly don't know why</p>



<a name="167798435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798435">(Jun 10 2019 at 21:31)</a>:</h4>
<p>everything takes longer than you think...</p>



<a name="167798676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798676">(Jun 10 2019 at 21:34)</a>:</h4>
<p>Anyway, my notes say that in the example I looked at, it seems that there was just one variable being needlessly live</p>



<a name="167798833"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798833" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798833">(Jun 10 2019 at 21:36)</a>:</h4>
<p>It was made live from a drop-use in an unwind block. If you in stead change the logic to consider it drop-used when it's moved, and then drop-live again only in the point where it was dropped but with no propagation (despite no reassignments killing it), results are the same</p>



<a name="167798896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167798896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167798896">(Jun 10 2019 at 21:37)</a>:</h4>
<p>In other words, I think the logic for <code>region_live_at</code> in rustc is not doing the flow calculations but rather something different</p>



<a name="167836831"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167836831" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167836831">(Jun 11 2019 at 10:18)</a>:</h4>
<p>(I have not looked at the liveness PRs so the following may be wrong) this reminds me of <a href="https://github.com/rust-lang/rust/issues/60840" target="_blank" title="https://github.com/rust-lang/rust/issues/60840">#60840</a> and <a href="https://github.com/rust-lang/rust/issues/61373" target="_blank" title="https://github.com/rust-lang/rust/issues/61373">#61373</a> about adding (adding back?) more <code>StorageDead</code> for some locals in unwind paths: it may be related if our fact generation used to rely on those and an optimization has removed some ? (since it seems to be a big perf regression to add them everywhere and in those PRs they had to be limited to generators)</p>



<a name="167875470"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167875470" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167875470">(Jun 11 2019 at 18:15)</a>:</h4>
<blockquote>
<p>In other words, I think the logic for <code>region_live_at</code> in rustc is not doing the flow calculations but rather something different</p>
</blockquote>
<p>let me double-check that</p>



<a name="167881883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167881883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167881883">(Jun 11 2019 at 19:21)</a>:</h4>
<blockquote>
<p>Anyway, my notes say that in the example I looked at, it seems that there was just one variable being needlessly live</p>
</blockquote>
<p>can you say a bit more about this?</p>



<a name="167882015"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882015" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882015">(Jun 11 2019 at 19:22)</a>:</h4>
<p>Yes, let me dig up my notes</p>



<a name="167882090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882090">(Jun 11 2019 at 19:23)</a>:</h4>
<p>Ok, so I looked at maybe-initialized-drop-with-uninitialized-fragments, main I think</p>



<a name="167882256"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882256" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882256">(Jun 11 2019 at 19:25)</a>:</h4>
<p>OK</p>



<a name="167882363"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882363" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882363">(Jun 11 2019 at 19:26)</a>:</h4>
<p>I'm looking at it :)</p>



<a name="167882372"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882372" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882372">(Jun 11 2019 at 19:26)</a>:</h4>
<p>And the difference is that provenance variable 13 is live at a number of blocks when it shouldn't be</p>



<a name="167882397"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882397" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882397">(Jun 11 2019 at 19:26)</a>:</h4>
<p>It's made live by a drop-use of _2 in bb3[0]</p>



<a name="167882419"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882419" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882419">(Jun 11 2019 at 19:27)</a>:</h4>
<p>Which is an unwind, I think</p>



<a name="167882441"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882441" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882441">(Jun 11 2019 at 19:27)</a>:</h4>
<p>hmm</p>



<a name="167882457"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882457" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882457">(Jun 11 2019 at 19:27)</a>:</h4>
<p>well let me dump the MIR locally</p>



<a name="167882506"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882506" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882506">(Jun 11 2019 at 19:28)</a>:</h4>
<p>Hm, no sorry it's a cleanup block which may or may not be an unwind</p>



<a name="167882533"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882533" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882533">(Jun 11 2019 at 19:28)</a>:</h4>
<p>I'm not sure</p>



<a name="167882547"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882547" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882547">(Jun 11 2019 at 19:28)</a>:</h4>
<p>ok so <code>_2</code> is the <code>Wrap&lt;'_&gt;</code></p>



<a name="167882553"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882553" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882553">(Jun 11 2019 at 19:28)</a>:</h4>
<p>the example:</p>
<div class="codehilite"><pre><span></span><span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="k">mut</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">0</span><span class="p">;</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">wrap</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Wrap</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">p</span>: <span class="kp">&amp;</span><span class="nc">mut</span><span class="w"> </span><span class="n">x</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">s</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">String</span>::<span class="n">from</span><span class="p">(</span><span class="s">&quot;str&quot;</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">foo</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">Foo</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">a</span>: <span class="nc">s</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">wrap</span><span class="w"> </span><span class="p">};</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">drop</span><span class="p">(</span><span class="n">foo</span><span class="p">.</span><span class="n">a</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">std</span>::<span class="n">mem</span>::<span class="n">drop</span><span class="p">(</span><span class="n">foo</span><span class="p">.</span><span class="n">b</span><span class="p">);</span><span class="w"></span>
<span class="w">    </span><span class="n">x</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">1</span><span class="p">;</span><span class="w"> </span><span class="c1">//~ ERROR cannot assign to `x` because it is borrowed [E0506]</span>
<span class="w">    </span><span class="c1">// FIXME ^ This currently errors and it should not.</span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="167882569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882569">(Jun 11 2019 at 19:28)</a>:</h4>
<p>the interesting bit here: <code>wrap</code> is moved into <code>foo</code></p>



<a name="167882588"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882588" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882588">(Jun 11 2019 at 19:29)</a>:</h4>
<p>we then move out all the <em>parts</em> of <code>foo</code>, but we never move from <code>foo</code> itself</p>



<a name="167882597"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882597" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882597">(Jun 11 2019 at 19:29)</a>:</h4>
<p>the current NLL fails to understand this</p>



<a name="167882605"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882605" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882605">(Jun 11 2019 at 19:29)</a>:</h4>
<p>so it assumes that the <code>foo</code> dtor could still run</p>



<a name="167882610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882610">(Jun 11 2019 at 19:29)</a>:</h4>
<p>which makes the borrow of <code>&amp;mut x</code> live</p>



<a name="167882925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882925">(Jun 11 2019 at 19:32)</a>:</h4>
<p>anyway yes ok so I see the unwind problem</p>



<a name="167882926"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882926" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882926">(Jun 11 2019 at 19:32)</a>:</h4>
<p>I noted that the following changes should give the same output in Polonius:<br>
- mark _2 as drop-used and drop-live at the point of the move (Mid(bb2[5]))<br>
- mark _2 as drop-live in bb3[0], but don't propagate that backwards (so, I guess, also kill/assign it it)<br>
- mark the move as a kill (assignment)</p>



<a name="167882937"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882937" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882937">(Jun 11 2019 at 19:32)</a>:</h4>
<p>basically <code>_2</code> is <em>potentially</em> live at <code>_3</code></p>



<a name="167882947"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882947" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882947">(Jun 11 2019 at 19:32)</a>:</h4>
<p>Ah</p>



<a name="167882961"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882961" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882961">(Jun 11 2019 at 19:32)</a>:</h4>
<p>the idea is this:</p>



<a name="167882969"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882969" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882969">(Jun 11 2019 at 19:32)</a>:</h4>
<p>if <code>String::from</code> should panic (say)</p>



<a name="167882979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882979">(Jun 11 2019 at 19:33)</a>:</h4>
<p>it would unwind and drop <code>wrap</code></p>



<a name="167882995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167882995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167882995">(Jun 11 2019 at 19:33)</a>:</h4>
<p>but now, later on, if <code>std::mem::drop</code> should panic</p>



<a name="167883000"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883000" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883000">(Jun 11 2019 at 19:33)</a>:</h4>
<p>we unwind through the same frame</p>



<a name="167883011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883011">(Jun 11 2019 at 19:33)</a>:</h4>
<p>of course, at that point, <code>wrap</code> will have been moved (dynamically)</p>



<a name="167883017"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883017" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883017">(Jun 11 2019 at 19:33)</a>:</h4>
<p>so now I have to remember where in the code</p>



<a name="167883020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883020">(Jun 11 2019 at 19:33)</a>:</h4>
<p>...this is sort of coming back to me..</p>



<a name="167883021"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883021" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883021">(Jun 11 2019 at 19:33)</a>:</h4>
<p>do we account for this and where</p>



<a name="167883086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883086">(Jun 11 2019 at 19:34)</a>:</h4>
<p>Ah</p>



<a name="167883333"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883333" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883333">(Jun 11 2019 at 19:38)</a>:</h4>
<p>(I'm currently staring at the liveness graph I generated by the extension I made to try to figure out what is going on)</p>



<a name="167883465"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883465" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883465">(Jun 11 2019 at 19:39)</a>:</h4>
<blockquote>
<p>which makes the borrow of <code>&amp;mut x</code> live</p>
</blockquote>
<p>Hm, but the problem I'm having is that Polonius is reporting to <em>many</em> live variables, not too few</p>



<a name="167883475"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883475" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883475">(Jun 11 2019 at 19:39)</a>:</h4>
<p>it looks <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> like we are integrating the initialization check deeply into the propagation</p>



<a name="167883517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883517">(Jun 11 2019 at 19:39)</a>:</h4>
<p>so I guess your original analysis was correct</p>



<a name="167883528"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883528" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883528">(Jun 11 2019 at 19:39)</a>:</h4>
<p>notably</p>



<a name="167883636"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883636" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883636">(Jun 11 2019 at 19:40)</a>:</h4>
<p>in <a href="https://github.com/rust-lang/rust/blob/8e948df707ea8a3c88c65bf2ffdcb2f1cf5491be/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L324-L327" target="_blank" title="https://github.com/rust-lang/rust/blob/8e948df707ea8a3c88c65bf2ffdcb2f1cf5491be/src/librustc_mir/borrow_check/nll/type_check/liveness/trace.rs#L324-L327">this code</a>, we decide to propagate back from a node N to its predecessors <em>only if</em> the path is initialized at the exit of the predecessor</p>



<a name="167883654"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883654" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883654">(Jun 11 2019 at 19:40)</a>:</h4>
<p>one option, it occurs to me</p>



<a name="167883671"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883671" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883671">(Jun 11 2019 at 19:40)</a>:</h4>
<p>if we wanted to remove <code>region_live_at</code> without loss of precision</p>



<a name="167883683"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883683" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883683">(Jun 11 2019 at 19:41)</a>:</h4>
<p>would be to emit facts for <code>initialized_at_exit</code></p>



<a name="167883695"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883695" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883695">(Jun 11 2019 at 19:41)</a>:</h4>
<p>i.e., we can emit <em>facts</em> for the stuff that polonius will compute later</p>



<a name="167883797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883797">(Jun 11 2019 at 19:42)</a>:</h4>
<p>I guess that <a href="https://github.com/rust-lang/polonius/blob/3f122afd019f9a4be0ce1d7e2844e52b0faf3c24/polonius-engine/src/output/liveness.rs#L86-L89" target="_blank" title="https://github.com/rust-lang/polonius/blob/3f122afd019f9a4be0ce1d7e2844e52b0faf3c24/polonius-engine/src/output/liveness.rs#L86-L89">this logic</a> would change:</p>
<div class="codehilite"><pre><span></span>var_drop_live(V, P) :-
    var_drop_live(V, Q),
    cfg_edge(P, Q),
    !var_defined(V, P).
</pre></div>



<a name="167883824"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883824" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883824">(Jun 11 2019 at 19:43)</a>:</h4>
<p>we want something like </p>
<div class="codehilite"><pre><span></span>var_drop_live(V, P) :-
    var_drop_live(V, Q),
    cfg_edge(P, Q),
    !var_defined(V, P),
    var_initialized_on_exit(V, P).
</pre></div>



<a name="167883960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167883960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167883960">(Jun 11 2019 at 19:45)</a>:</h4>
<p>that's an interesting step</p>



<a name="167884178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884178">(Jun 11 2019 at 19:47)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  oh ok, so we cheat by emitting initialisation facts in rust, the same ones we will compute in the next step, and use those as a crutch to make sure we will eventually get the right output?</p>



<a name="167884236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884236">(Jun 11 2019 at 19:48)</a>:</h4>
<p>right</p>



<a name="167884245"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884245" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884245">(Jun 11 2019 at 19:48)</a>:</h4>
<p>oh, that's also good in a second way</p>



<a name="167884266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884266">(Jun 11 2019 at 19:48)</a>:</h4>
<p>because that gives us free validation when we roll out initialisation in Polonius</p>



<a name="167884289"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884289" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884289">(Jun 11 2019 at 19:49)</a>:</h4>
<p>in precisely the same way as for region_live_at</p>



<a name="167884301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884301">(Jun 11 2019 at 19:49)</a>:</h4>
<p>ok, <em>sold</em>!</p>



<a name="167884456"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884456" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884456">(Jun 11 2019 at 19:51)</a>:</h4>
<p>yeah that's kind of nice</p>



<a name="167884483"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884483" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884483">(Jun 11 2019 at 19:51)</a>:</h4>
<p>it would definitely be good to transition <em>fully</em> to polonius for liveness</p>



<a name="167884490"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884490" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884490">(Jun 11 2019 at 19:51)</a>:</h4>
<p>and not have some intermediate state where we sometimes use rustc's liveness</p>



<a name="167884750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884750">(Jun 11 2019 at 19:54)</a>:</h4>
<p>Yes, that would be nice. But initialisation tracking is the last step for that right?</p>



<a name="167884770"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884770" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884770">(Jun 11 2019 at 19:54)</a>:</h4>
<p>I'm saying that if we add these facts for now</p>



<a name="167884773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884773">(Jun 11 2019 at 19:55)</a>:</h4>
<p>we are able to kill the old liveness completely</p>



<a name="167884791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884791">(Jun 11 2019 at 19:55)</a>:</h4>
<p>and then we transition from <em>those</em> to doing the init tracking ourselves</p>



<a name="167884802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884802">(Jun 11 2019 at 19:55)</a>:</h4>
<p>Ah, ok</p>



<a name="167884823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884823">(Jun 11 2019 at 19:55)</a>:</h4>
<p>I thought I already did kill the liveness tracking in my branch?</p>



<a name="167884839"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167884839" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167884839">(Jun 11 2019 at 19:55)</a>:</h4>
<p>Or was that what you were referring to?</p>



<a name="167886253"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167886253" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167886253">(Jun 11 2019 at 20:12)</a>:</h4>
<p>yes, you did, it's just that we don't get the exact same results right now, and <span class="user-mention" data-user-id="116113">@lqd</span> was concerned about that (for testing purposes)</p>



<a name="167886301"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167886301" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167886301">(Jun 11 2019 at 20:13)</a>:</h4>
<p>Ah ok, then I understand how everything fits. And I agree that it would feel much, much better to have the same output</p>



<a name="167886328"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167886328" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167886328">(Jun 11 2019 at 20:13)</a>:</h4>
<p>Until we have implemented this I think it's all just a hypothesis anyway</p>



<a name="167886439"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/167886439" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#167886439">(Jun 11 2019 at 20:15)</a>:</h4>
<p>I need to go to bed now, but I'll go through your notes on initialization and see where that gets me in terms of implementing <code>var_initialized_on_exit</code></p>



<a name="168055995"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168055995" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168055995">(Jun 13 2019 at 15:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Ok, the liveness-debug-graph-generation is now available as a mergable (hopefully) PR: <a href="https://github.com/rust-lang-nursery/polonius/issues/108" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/108">polonius#108</a>.</p>



<a name="168060608"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168060608" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168060608">(Jun 13 2019 at 16:22)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> cool!</p>



<a name="168060621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168060621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168060621">(Jun 13 2019 at 16:22)</a>:</h4>
<p>Regarding the overall status, am I correct that you are attempting to integrate the init information into the liveness analysis as we discussed, to eliminate the remaining discrepancy?</p>



<a name="168060759"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168060759" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168060759">(Jun 13 2019 at 16:24)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Yes! I started working on that today</p>



<a name="168061029"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168061029" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168061029">(Jun 13 2019 at 16:27)</a>:</h4>
<p>I'm not sure how to go from the maybe initialized information in rust to actually knowing if something is initialized or not, but I guess the fact should be emitted only if we absolutely know that a variable is initialized?</p>



<a name="168061037"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168061037" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168061037">(Jun 13 2019 at 16:27)</a>:</h4>
<p>(or have been deinitialized)</p>



<a name="168066600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168066600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168066600">(Jun 13 2019 at 17:31)</a>:</h4>
<p>btw the description from <a href="https://github.com/rust-lang/rust/issues/54468" target="_blank" title="https://github.com/rust-lang/rust/issues/54468">#54468</a> mentions some limitation about the invalidation/drop facts, would that impact liveness (or our complete regenerating of the recorded facts) ? -- (of course, some of these limitations, the invalidation ones or 2PBs, are likely linked to the test failures we're seeing in compare mode)</p>



<a name="168122382"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168122382" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168122382">(Jun 14 2019 at 10:02)</a>:</h4>
<p>Ok, so I have an idea to inject the code to generate <code>var_initialized_on_exit</code> facts in <code>trace()</code> (where I know that information already exists), but it seems I would need to iterate over every location in the MIR and basically ask "is V initialized here?". Now, I can't find an easy way of iterating over all locations in the MIR, and also this feels like an unnecessarily slow way of going about this</p>



<a name="168123332"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168123332" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168123332">(Jun 14 2019 at 10:18)</a>:</h4>
<p>Oh no that seems to require a MIR visitor</p>



<a name="168124593"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168124593" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168124593">(Jun 14 2019 at 10:40)</a>:</h4>
<p>Hmm, or should we just emit the facts for the exit point of a given <code>BasicBlock</code>? Also, should this fact be emitted even on partial initialization?</p>



<a name="168124737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168124737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168124737">(Jun 14 2019 at 10:43)</a>:</h4>
<p>Or should var rather be a move path with a separate relation mapping variables to their move paths?</p>



<a name="168124796"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168124796" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168124796">(Jun 14 2019 at 10:44)</a>:</h4>
<p>Hm, but if we use this analysis <em>only</em> for drop-liveness (for now), then I guess we should track any initialisation at all, right?</p>



<a name="168127315"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168127315" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168127315">(Jun 14 2019 at 11:31)</a>:</h4>
<blockquote>
<p>I'm not sure how to go from the maybe initialized information in rust to actually knowing if something is initialized or not, but I guess the fact should be emitted only if we absolutely know that a variable is initialized?</p>
</blockquote>
<p>well "maybe initialized" is actually what we want, I think? That is, we want to halt propagation if we know that something is <em>definitely</em> uninitialized, but not otherwise.</p>



<a name="168127391"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168127391" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168127391">(Jun 14 2019 at 11:32)</a>:</h4>
<blockquote>
<p>Hmm, or should we just emit the facts for the exit point of a given <code>BasicBlock</code>? Also, should this fact be emitted even on partial initialization?</p>
</blockquote>
<p>in practice, we only care about the exit of a block at the moment, so that suffices I guess</p>



<a name="168127416"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168127416" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168127416">(Jun 14 2019 at 11:33)</a>:</h4>
<blockquote>
<p>Or should var rather be a move path with a separate relation mapping variables to their move paths?</p>
</blockquote>
<p>I think we could just use variables because that is the basis of the liveness computation -- the <em>real</em> initialization logic will want to use sub-paths</p>



<a name="168127495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168127495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168127495">(Jun 14 2019 at 11:34)</a>:</h4>
<p>(iterating over all locations in the MIR is certainly possible)</p>



<a name="168127834"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168127834" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168127834">(Jun 14 2019 at 11:40)</a>:</h4>
<blockquote>
<p>(iterating over all locations in the MIR is certainly possible)</p>
</blockquote>
<p>Ok, I'll keep looking for that in the documentation then, because I think this should work otherwise.</p>



<a name="168127889"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168127889" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168127889">(Jun 14 2019 at 11:41)</a>:</h4>
<p>What is the difference between something being initialised at a terminator compared to at the exit of a block? Shouldn't they be the same?</p>



<a name="168128215"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168128215" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168128215">(Jun 14 2019 at 11:47)</a>:</h4>
<p>Hmh, so it does some sort of recomputation:</p>
<div class="codehilite"><pre><span></span><span class="c1">// Compute the set of initialized paths at terminator of block</span>
<span class="c1">// by resetting to the start of the block and then applying</span>
<span class="c1">// the effects of all statements. This is the only way to get</span>
<span class="c1">// &quot;just ahead&quot; of a terminator.</span>
</pre></div>


<p>Hm, basically both methods check <code>flow_inits</code>, to see if any part of the variable's move path is still initialised, but <code> at_terminator</code> re-performs the effects of each statement in the block, and <code>at_exit</code> just returns whatever's in <code>flow_inits</code>at the exit point.</p>



<a name="168128385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168128385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168128385">(Jun 14 2019 at 11:50)</a>:</h4>
<p>(feel free to throttle messages because I might be rubber-ducking you right now)</p>



<a name="168128396"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168128396" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168128396">(Jun 14 2019 at 11:50)</a>:</h4>
<p>that's also why I'm not @:ing anyone</p>



<a name="168131052"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168131052" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168131052">(Jun 14 2019 at 12:35)</a>:</h4>
<p>Ok I think I figured it out now</p>



<a name="168131058"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168131058" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168131058">(Jun 14 2019 at 12:35)</a>:</h4>
<p>Let's see if it works</p>



<a name="168131103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168131103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168131103">(Jun 14 2019 at 12:36)</a>:</h4>
<p>correction, let's see if it <em>runs</em></p>



<a name="168175712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175712">(Jun 14 2019 at 22:11)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> sorry was afk-ish :)</p>



<a name="168175733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175733">(Jun 14 2019 at 22:11)</a>:</h4>
<p>what is <code>at_exit</code>?</p>



<a name="168175735"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175735" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175735">(Jun 14 2019 at 22:11)</a>:</h4>
<p>:)</p>



<a name="168175791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175791">(Jun 14 2019 at 22:12)</a>:</h4>
<p>oh, you mean the <code>initialized_at_exit</code> function</p>



<a name="168175797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175797">(Jun 14 2019 at 22:12)</a>:</h4>
<p>right so</p>



<a name="168175800"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175800" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175800">(Jun 14 2019 at 22:12)</a>:</h4>
<p>here's the thing</p>



<a name="168175816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175816">(Jun 14 2019 at 22:12)</a>:</h4>
<p>the <em>terminator</em> of a MIR block  can make assignments (in the case of a function call)</p>



<a name="168175817"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175817" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175817">(Jun 14 2019 at 22:12)</a>:</h4>
<p>e.g.</p>



<a name="168175836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175836">(Jun 14 2019 at 22:13)</a>:</h4>
<div class="codehilite"><pre><span></span>BB0 {
    X = call foo(A, B, C) goto BB1 unwind BB2
}
</pre></div>



<a name="168175841"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175841" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175841">(Jun 14 2019 at 22:13)</a>:</h4>
<p>well I forget how we pretty-print it</p>



<a name="168175851"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175851" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175851">(Jun 14 2019 at 22:13)</a>:</h4>
<p>so the <code>at_exit</code> call is checking the effect <em>after</em> the terminator executes -- meaning that <code>A</code>, <code>B</code>, and <code>C</code> would have been consumed</p>



<a name="168175857"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175857" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175857">(Jun 14 2019 at 22:13)</a>:</h4>
<p>but <code>at_terminator</code> is checking the state <em>just before</em> the terminator executes -- so <code>A..C</code> would not yet have been consumed</p>



<a name="168175904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175904">(Jun 14 2019 at 22:14)</a>:</h4>
<p>the subtlety around calls that <code>at_exit</code> is referring to is the fact that the variable <code>X</code></p>



<a name="168175916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175916">(Jun 14 2019 at 22:14)</a>:</h4>
<p>is only going to be initialized if we enter BB1 -- i.e., on a normal return</p>



<a name="168175921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175921">(Jun 14 2019 at 22:14)</a>:</h4>
<p>if an unwind occurs (BB2) then it would not be initialized</p>



<a name="168175973"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/168175973" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#168175973">(Jun 14 2019 at 22:16)</a>:</h4>
<p>I think <code>at_exit</code> will return a value where <code>X</code> is not yet initialized</p>



<a name="169559623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169559623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169559623">(Jul 03 2019 at 11:56)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Ok, <a href="https://github.com/rust-lang-nursery/polonius/issues/109" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/109">polonius#109</a> should be ready to merge now!</p>



<a name="169562581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169562581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169562581">(Jul 03 2019 at 12:42)</a>:</h4>
<p>Really love these two-hour merges every time</p>



<a name="169562589"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169562589" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169562589">(Jul 03 2019 at 12:42)</a>:</h4>
<p>Should be trivial, but never are</p>



<a name="169563039"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169563039" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169563039">(Jul 03 2019 at 12:48)</a>:</h4>
<p>Apparently, the rebase...somehow reverts changes that it never shows merge conflicts for</p>



<a name="169563047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169563047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169563047">(Jul 03 2019 at 12:48)</a>:</h4>
<p>I don't understand how that is even possible</p>



<a name="169563501"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169563501" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169563501">(Jul 03 2019 at 12:55)</a>:</h4>
<p>Specifically, commit <code>0d2b8d5cfd8</code>seems to just change to undo upstream</p>



<a name="169568109"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169568109" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169568109">(Jul 03 2019 at 13:54)</a>:</h4>
<p>(deleted)</p>



<a name="169568432"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169568432" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169568432">(Jul 03 2019 at 13:57)</a>:</h4>
<p>Ah, ok, I see. It's a rustfmt run that also...replaces all the rustfmt:ed lines.</p>



<a name="169568551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169568551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169568551">(Jul 03 2019 at 13:58)</a>:</h4>
<p>It seems to be this commit: <a href="https://github.com/rust-lang/rust/pull/60266/commits/494b6914c5f61df180ce652752430e5ff4367048" target="_blank" title="https://github.com/rust-lang/rust/pull/60266/commits/494b6914c5f61df180ce652752430e5ff4367048">https://github.com/rust-lang/rust/pull/60266/commits/494b6914c5f61df180ce652752430e5ff4367048</a></p>



<a name="169568557"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169568557" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169568557">(Jul 03 2019 at 13:59)</a>:</h4>
<p>I actually have no idea how to solve this</p>



<a name="169572768"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169572768" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169572768">(Jul 03 2019 at 14:47)</a>:</h4>
<p>Yessss Ok I got it to work now</p>



<a name="169572778"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169572778" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169572778">(Jul 03 2019 at 14:47)</a>:</h4>
<p>After THREE HOURS</p>



<a name="169573284"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169573284" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169573284">(Jul 03 2019 at 14:52)</a>:</h4>
<p>Ok, waiting on the new Polonius release now!</p>



<a name="169587701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169587701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169587701">(Jul 03 2019 at 17:50)</a>:</h4>
<p>Haha, the newly rebased rustc will produce different basic block IDs</p>



<a name="169587712"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169587712" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169587712">(Jul 03 2019 at 17:50)</a>:</h4>
<p>In other words; almost entirely different input facts</p>



<a name="169587717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169587717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169587717">(Jul 03 2019 at 17:51)</a>:</h4>
<p>(still passing all tests though)</p>



<a name="169893555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169893555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169893555">(Jul 08 2019 at 18:34)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="116009">nikomatsakis</span> Ok, <a href="https://github.com/rust-lang-nursery/polonius/issues/109" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/109">polonius#109</a> should be ready to merge now!</p>
</blockquote>
<p>awesome!</p>



<a name="169893632"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/169893632" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#169893632">(Jul 08 2019 at 18:35)</a>:</h4>
<p>OK, I merged <a href="https://github.com/rust-lang-nursery/polonius/issues/109" target="_blank" title="https://github.com/rust-lang-nursery/polonius/issues/109">polonius#109</a>, <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> I'll publish a new version</p>



<a name="170439933"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170439933" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170439933">(Jul 09 2019 at 10:11)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> so <a href="https://github.com/rust-lang/rust/pull/60266" target="_blank" title="https://github.com/rust-lang/rust/pull/60266">https://github.com/rust-lang/rust/pull/60266</a> is failing the PR checks, but I can't get the logs, maybe spurious?</p>



<a name="170440762"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170440762" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170440762">(Jul 09 2019 at 10:25)</a>:</h4>
<blockquote>
<p><span class="user-mention silent" data-user-id="204115">Albin Stjerna</span> so <a href="https://github.com/rust-lang/rust/pull/60266" target="_blank" title="https://github.com/rust-lang/rust/pull/60266">https://github.com/rust-lang/rust/pull/60266</a> is failing the PR checks, but I can't get the logs, maybe spurious?</p>
</blockquote>
<p>I think it's because I haven't adapted it to the newly released Polonius yet, I'll do that...now!</p>



<a name="170441517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170441517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170441517">(Jul 09 2019 at 10:36)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> Ok, now <a href="https://github.com/rust-lang/rust/issues/60266" target="_blank" title="https://github.com/rust-lang/rust/issues/60266">rust#60266</a> should build, I just pushed a commit upgrading Polonius!</p>



<a name="170455788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170455788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170455788">(Jul 09 2019 at 14:05)</a>:</h4>
<p>the PR check is green <span aria-label="thumbs up" class="emoji emoji-1f44d" role="img" title="thumbs up">:thumbs_up:</span></p>



<a name="170723917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170723917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170723917">(Jul 12 2019 at 13:57)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> needs rebase :(</p>



<a name="170723927"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170723927" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170723927">(Jul 12 2019 at 13:57)</a>:</h4>
<p>also, maybe worth squashing the commits somewhat?</p>



<a name="170723938"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170723938" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170723938">(Jul 12 2019 at 13:57)</a>:</h4>
<p>I found it kind of hard to re-review as is</p>



<a name="170724020"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170724020" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170724020">(Jul 12 2019 at 13:58)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span> I saw, but too late unfortunately:(</p>



<a name="170724035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170724035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170724035">(Jul 12 2019 at 13:58)</a>:</h4>
<p>But yes it’s getting a bit messy</p>



<a name="170724290"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170724290" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170724290">(Jul 12 2019 at 14:02)</a>:</h4>
<p>I’ll try squashing it when I’m rebasing</p>



<a name="170755129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755129">(Jul 12 2019 at 20:56)</a>:</h4>
<p><span class="user-mention" data-user-id="116009">@nikomatsakis</span>  Ok I went whole-hog and just rewrote the entire history a lá my previous fun/boring commits to Polonius. I must say I enjoy having to learn more about git, and I have absolutely come to love magit at this point.</p>



<a name="170755144"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755144" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755144">(Jul 12 2019 at 20:56)</a>:</h4>
<p>magit is life changing</p>



<a name="170755145"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755145" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755145">(Jul 12 2019 at 20:56)</a>:</h4>
<p>it is also the most emacs of all interfaces</p>



<a name="170755152"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755152" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755152">(Jul 12 2019 at 20:56)</a>:</h4>
<p>and I don't mean that in a good way</p>



<a name="170755244"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755244" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755244">(Jul 12 2019 at 20:58)</a>:</h4>
<p>Yeah it's slow for no reason and very obviously interacts flakily with a shell script</p>



<a name="170755246"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755246" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755246">(Jul 12 2019 at 20:58)</a>:</h4>
<p>I have/love emacs so much</p>



<a name="170755252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755252">(Jul 12 2019 at 20:58)</a>:</h4>
<p>It's like LaTeX</p>



<a name="170755266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170755266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170755266">(Jul 12 2019 at 20:58)</a>:</h4>
<p>It's great at what it does and also awful at what it does and it should be replaced, but the path dependency on it is just awful so that will never happen</p>



<a name="170761546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170761546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170761546">(Jul 12 2019 at 22:57)</a>:</h4>
<p>if it's just rebasing and doesn't need re-review, which I assume is the case, we can tell bors r=niko when CI is green (if so, I'll do that in the morning)</p>



<a name="170777082"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170777082" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170777082">(Jul 13 2019 at 06:31)</a>:</h4>
<p><span class="user-mention" data-user-id="116113">@lqd</span> It is and it shouldn't</p>



<a name="170777083"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170777083" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170777083">(Jul 13 2019 at 06:31)</a>:</h4>
<p>Can I do that?</p>



<a name="170777085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170777085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170777085">(Jul 13 2019 at 06:31)</a>:</h4>
<p>I'm still not sure what I can do</p>



<a name="170779498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170779498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170779498">(Jul 13 2019 at 07:40)</a>:</h4>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span>  I think you need bors rights, I did it</p>



<a name="170801777"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170801777" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170801777">(Jul 13 2019 at 19:11)</a>:</h4>
<p>liveness landed <span class="user-mention" data-user-id="204115">@Albin Stjerna</span> <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="170802983"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170802983" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170802983">(Jul 13 2019 at 19:49)</a>:</h4>
<p>I saw! <span aria-label="tada" class="emoji emoji-1f389" role="img" title="tada">:tada:</span></p>



<a name="170917352"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/170917352" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Aaron Weiss <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#170917352">(Jul 15 2019 at 18:10)</a>:</h4>
<blockquote>
<p>It's like LaTeX</p>
</blockquote>
<p><span class="user-mention" data-user-id="204115">@Albin Stjerna</span> honestly, Emacs is much more tolerable than LaTeX in that the former at least mostly works.</p>



<a name="177767402"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/177767402" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#177767402">(Oct 10 2019 at 00:03)</a>:</h4>
<p>I haven't kept up with the liveness work as much as I should have, so maybe this is normal, but in the <code>polonius-imprecision/cycle_unification</code> test case, I feel liveness has changed from when it was computed by rustc: it seems to start one point earlier, eg at the mid point <a href="https://github.com/lqd/borrow-check/blob/variant_prototype2/inputs/polonius-imprecision/polonius-imprecision.rs#L28" target="_blank" title="https://github.com/lqd/borrow-check/blob/variant_prototype2/inputs/polonius-imprecision/polonius-imprecision.rs#L28">of an assignment</a> and not at the start point of the successor location (which is how it used to be IIRC); is that something you'd expect ? (or maybe am I misunderstanding something ?)</p>



<a name="177769048"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/177769048" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#177769048">(Oct 10 2019 at 00:34)</a>:</h4>
<p>ah but I think it's actually been fixed by Matthew's PR</p>



<a name="177783726"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/177783726" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#177783726">(Oct 10 2019 at 06:46)</a>:</h4>
<p>That is a bit weird, because I did extensive comparisons to the output of rustc and definitely had the same output</p>



<a name="177789904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/177789904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#177789904">(Oct 10 2019 at 08:39)</a>:</h4>
<p>yeah I remember, that's why this was confusing; maybe it's subtle differences between nightlies which were misleading me (eg. the number of blocks changed recently making all my notes misnumbered :)</p>



<a name="177913663"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/177913663" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#177913663">(Oct 11 2019 at 14:46)</a>:</h4>
<p>ok I now see what you mean about initialization and liveness dominating runtime in your benchmarks; eg in my latest test on clap:<br>
- initialization: 474 ms<br>
- liveness: 278 ms<br>
- borrow checking: 42ms</p>



<a name="177994647"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/177994647" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#177994647">(Oct 12 2019 at 15:53)</a>:</h4>
<p>alright <a href="https://github.com/rust-lang/rust/issues/134" target="_blank" title="https://github.com/rust-lang/rust/issues/134">#134</a> should help with your real world benchmarks (but not eg our clap ones, where code always passes the locationinsensitive pre-filter) to avoid computing init/liveness twice</p>



<a name="178023559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178023559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178023559">(Oct 13 2019 at 06:20)</a>:</h4>
<p>Yay!</p>



<a name="178034836"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178034836" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178034836">(Oct 13 2019 at 11:41)</a>:</h4>
<p>I do believe it should be fairly easy to optimize the liveness computation by doing it on less variables — and similarly for initialization by computing <code>var_maybe_initialized_on_exit</code> on less paths (but I'm still fuzzy on its possible use outside of liveness, eg maybe ... initialization errors ?) and unsure about the ongoing work on that anyways, so likely TBD later; although on clap, initialization is dominating runtime as we mentioned before</p>



<a name="178034957"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178034957" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178034957">(Oct 13 2019 at 11:45)</a>:</h4>
<p>(I'll try to prototype that for liveness, and run rustc's tests, hopefully by next week's meeting)</p>



<a name="178043433"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178043433" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178043433">(Oct 13 2019 at 15:57)</a>:</h4>
<p>Hm var maybe...is only needed for drop-liveness, but move path initialisation is needed for move errors</p>



<a name="178043488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178043488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178043488">(Oct 13 2019 at 15:58)</a>:</h4>
<p>That is, it is needed precisely when the variable holds a struct implementing a custom drop and that struct contains (transitively I guess) a reference</p>



<a name="178043491"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178043491" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178043491">(Oct 13 2019 at 15:58)</a>:</h4>
<p>Which is basically never according to my estimates</p>



<a name="178054085"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178054085" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178054085">(Oct 13 2019 at 20:41)</a>:</h4>
<p>if what I have in mind works (we'll see with rustc's tests, as ours seem to pass) it should be helpful to reduce the number of tuples produced by quite a bit; even if the relation is almost never useful, we still have to compute it in case it is actually useful heh. but yeah we can detect and limit the work to compute it when it's not used, say. and it should have the same effect as the reduction I'm trying (and which seems to have some potential <em>/me whistles until I can run the tests</em> :)</p>



<a name="178089255"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178089255" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> lqd <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178089255">(Oct 14 2019 at 09:59)</a>:</h4>
<p>(FWIW, ie not that much, but better than nothing: it did pass rustc's ui tests. With, on clap, 30x faster initialization -- that is completely unsuitable for computing move/initialization errors if we wanted to do that -- and 25x faster liveness, which I guess is sound IIUC, but we'll check with niko. Overall 10x on clap since it's early returned by LocationInsensitive)</p>



<a name="178096339"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/186049-t-compiler/wg-polonius/topic/liveness%20polonius%23104/near/178096339" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Amanda Stjerna <a href="https://rust-lang.github.io/zulip_archive/stream/186049-t-compiler/wg-polonius/topic/liveness.20polonius.23104.html#178096339">(Oct 14 2019 at 11:57)</a>:</h4>
<p>Cool!</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>